A WordPress-centric search engine for devs and theme authors



register_post_meta ›

Since4.9.8
Deprecatedn/a
register_post_meta ( $post_type, $meta_key, $args )
Parameters: (3)
  • (string) $post_type Post type to register a meta key for. Pass an empty string to register the meta key across all existing post types.
    Required: Yes
  • (string) $meta_key The meta key to register.
    Required: Yes
  • (array) $args Data used to describe the meta key when registered. See register_meta for a list of supported arguments.
    Required: Yes
Returns:
  • (bool) True if the meta key was successfully registered, false if not.
Defined at:
Codex:

Registers a meta key for posts.



Source

function register_post_meta( $post_type, $meta_key, array $args ) {
	$args['object_subtype'] = $post_type;

	return register_meta( 'post', $meta_key, $args );
}