How do I save an array of objects in Wordpress/PHP via update_option ?
What I'm trying to save is something like:
update_option('my_option', [
{
'c': htmlspecialchars($_POST['hidden_category']),
't': htmlspecialchars($_POST['hidden_tags'])
},
{
'c': htmlspecialchars($_POST['hidden_category_1']),
't': htmlspecialchars($_POST['hidden_tags_1'])
},
//etc..
]);
$_POST['hidden_category'] contains a string
while
$_POST['hidden_tags'] contains an array of strings
[{ .. }, { .. }, { .. }]structure itself is something update_option/php/mysql accepts?var_dump(json_decode(get_option( 'my_option' )[0]))returns null with a var_dump , butget_option( 'my_option' )var_dumpsarray(1) { [0]=> string(112) "{c: "MyCategory", t: "tag1, tag2, tag3" }" }