Function: register_post_meta

register_post_meta( string $post_type, string $meta_key, array $args )

Registers a meta key for posts.

Shortcut: rpm

You can use above key combination to trigger the associated snippet for this function in the WordPress Snippets for Visual Studio Code extension. You can also use this shortcut to search for this function on this website.

Parameters

Name Type(s) Default Value Description
$post_type string

Post type to register a meta key for. Pass an empty string to register the meta key across all existing post types.

$meta_key string

The meta key to register.

$args array

Data used to describe the meta key when registered. See {@see register_meta()} for a list of supported arguments.

Returns

boolean

True if the meta key was successfully registered, false if not.

WordPress Developer Newsletter

Stay informed of new chapter releases, important WordPress API updates and more.