The WordPress metadata API is a simple way to store and retrieve information related to various objects in WordPress, such as posts, users, comments, and taxonomy terms. Out of the box, WordPress includes post meta, user meta, comment meta, and term meta, but what if you want metadata on other objects, such as custom objects provided by a plugin? Thankfully, the metadata API is actually quite simple to extend, allowing developers to easily register their own kind of metadata that is attached to their own, custom objects. Before diving into how we can extend the metadata API, let’s have a quick refresher on the existing metadata functions available in WordPress. For each object type, there are four primary functions used by developers: get add update delete Posts For post objects, we have the following metadata functions: get_post_meta() add_post_meta() update_post_meta() delete_post_meta() Comments For comment objects, we have the following metadata functions: get_comment_meta() add_comment_meta() update_comment_meta() delete_comment_meta() Users For user objects, we have the following metadata functions: get_user_meta() add_user_meta() update_user_meta() delete_user_meta() Terms
Share This

We are using cookies on our website

Please confirm, if you accept our tracking cookies. You can also decline the tracking, so you can continue to visit our website without any data sent to third party services.