WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am planning on building a plugin and i need to know if the data stored in the options table i will create for the plugin will be serialized or it will be in the ordinary sql format.

share|improve this question
up vote 3 down vote accepted

It totally depends on what data is being stored in the option, maybe_serialize will determine in the option is holding a singular static value, such as true/false, 0/1, empty string, whatever(it's called when an option is created or updated).. it will serialize when dealing with objects and arrays, singular values are not serialized.

The get_option function is equipped to deal with this however and will unserialize(or not) as necessary for you(using maybe_unserialize) when it's called, which basically does the inverse of maybe_serialize.

Hope that helps..

EDIT: Confirmed - checked source, above information is correct regarding serialization.

share|improve this answer

I am pretty sure it is searilized.

update_option() function serailizes the data passed.

The get_option() function deseralizes it.

share|improve this answer

Depends on some factors.

If you're storing options in the db trough WP's API, like using add_option() then the data is automatically serialized by WP if the option is a array.

(same happens in widgets)

If you don't want serialized data then just don't pass arrays to add_option. If you have multiple options you could serialize it yourself and send it as a string before you pass it to the function...

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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