Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



register_post_meta ›

Seit4.9.8
Veraltetn/v
register_post_meta ( $post_type, $meta_key, $args )
Parameter: (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.
    Erforderlich: Ja
  • (string) $meta_key The meta key to register.
    Erforderlich: Ja
  • (array) $args Data used to describe the meta key when registered. See register_meta for a list of supported arguments.
    Erforderlich: Ja
Gibt zurück:
  • (bool) True if the meta key was successfully registered, false if not.
Definiert in:
Codex:

Registers a meta key for posts.



Quellcode

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

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