wordpress-playground icon indicating copy to clipboard operation
wordpress-playground copied to clipboard

setSiteOptions: Serialize array inputs

Open adamziel opened this issue 10 months ago • 0 comments

Let's serialize Object and Array values in setSiteOptions step.

I just got a question about disabling WooCommerce onboarding. This Blueprint did not work:

    {
      "step": "setSiteOptions",
      "options": {
        "woocommerce_onboarding_profile": {
          "completed": true
        }
      }
    }

This one, however, works:

    {
      "step": "setSiteOptions",
      "options": {
        "woocommerce_onboarding_profile": "a:1:{s:9:\"completed\";b:1;}"
      }
    },

It never makes sense to string-cast the value and write [Object object] – therefore let's automatically PHP serialize anything that isn't a string, number, or a boolean.

adamziel avatar Apr 16 '24 11:04 adamziel