wordpress-playground
wordpress-playground copied to clipboard
setSiteOptions: Serialize array inputs
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.