I need to store some post IDs in the DB in a custom table/field. The IDs will have to be stored in a serialized format. I know that, ie. for the options, serialization is done automatically for add/update functions (add_option(), update_option()). Is there a built-in WP function to serialize data for any other case? Or should I just use serialize()? Similarly, as soon as the data will be retrieved, is there a stock WP function to unserialize it, or will I have to use unserialize()? Thanks in advance for your replies!

1 Answer 1


WP functions...

Serialize: maybe_serialze

Unserialize: maybe_unserialize

  • Thank you very much!
    – Faye D.
    May 28, 2022 at 3:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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