Wordpress - How do you store options with a:n:{{}} syntax in wp_options?

Just pass an array when updating your option. It will be serialized automatically.


The serialization is done automatically, but if you want to know how to do this manually the function to look at is called serialize()


As per other answers (un)serialization is performed automatically on more complex data formats (arrays, objects) when options are stored or retrieved. This also applies to transients and other functionality.

Technically this is performed by internal usage maybe_serialize() and maybe_unserialize() functions that try to determine if data needs to be processed or passed as is.