0

In my WP code I grab my options information as such $options = get_option("kaipo_plugin_options");

The array that I print out looks as follows

a:2:{s:20:"Kaipo_banner_heading";s:5:"hello";s:10:"Kaipo_logo";s:61:"http://nzbaddystore.com/wp-content/uploads/2015/04/images.jpg";}

I want to transform this array into a javascript object dynamically? any suggestions? that way I can simply choose specific data from my array and print it out for the users to see. for example $options['kaipo_banner_heading'];

  • Your data should already be unserialized - currently it's still a string. How are you saving your options? – TheDeadMedic Apr 24 '15 at 13:17
  • using add_option – LinDan ChongWei Apr 24 '15 at 13:21
  • Is there a way I can transform that array into a much simpler javascript object to work with on the front end? fr example if I wanted to just grab the email link – LinDan ChongWei Apr 24 '15 at 13:22
0

It seems like that your result is not being unserialized. try:

$options = get_option("kaipo_plugin_options");
$unserialized_options = maybe_unserialize($options);
print_r($unserialized_options, true);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.