WordPress at a glance

register_post_meta() WP 1.0

Registers a meta key for posts.

Works based on: register_meta()
✈ 1 time = 0.000126s = fast | 50000 times = 0.27s = very fast | PHP 7.1.11, WP 4.9.8

No Hooks.

Return

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

Usage

register_post_meta( $post_type, $meta_key, $args );
$post_type(string) (required)
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) (required)
The meta key to register.
$args(array) (required)
Data used to describe the meta key when registered. See register_meta() for a list of supported arguments.

Changelog

Since 4.9.8 Introduced.

Code of register post meta: wp-includes/post.php WP 5.2.4

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

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

Related Functions

From tag: WP extension (enhancement)

More from tag: Metadatas (any)

No comments
    Hello, !     Log In . Register