I’m trying to determine how to retrieve custom values from wp_options when the values are stored in a single options array.
For example, I’ve got the following data in wp_options for option_value where option_name = “my_category_fields_option”. The i:n value represents the category id of the category that holds the custom “my_title” data]
a:2:{i:10;a:1:{s:8:”my_title”;s:48:”Iced Tea: A Great Choice for Cooling Refreshment”;}i:20;a:1:{s:8:”my_title”;s:30:”Black Tea is Good for the Soul”;}}
How would I retrieve the value for “my_title” (which should be “Hello World”) when I’m viewing the category archive page for this category?
(assuming you’re talking about Any examples of adding custom fields to the category editor?)
If you pass an array to the update_option it will automatically serialize it. you can later retrieve them back into an array like this.
then do something like var_dump (
$options
) this will show you the entire array.I think they use the maybe_serialize/maybe_unserialize/is_serialized functions from the codex, but I never really looked into it. Just found them now.
http://codex.wordpress.org/Function_Reference/maybe_serialize