The Metadata API is the unified WordPress system for storing and retrieving extra information attached to any of WordPress's core object types: posts, users, terms (taxonomy terms), and comments. Rather than having separate storage systems for post-specific data, user profile fields, and term descriptions, WordPress channels all custom key-value data through the Metadata API, which handles database queries, caching, and data sanitization in a consistent way. The four core functions follow a predictable pattern: add_{object-type}_meta(), update_{object-type}_meta(), get_{object-type}_meta(), and delete_{object-type}_meta() — replacing {object-type} with post, user, term, or comment. Data stored via the Metadata API is accessible in the REST API when the meta key is registered using register_meta() with show_in_rest => true.
Glossary entry