register_term_meta() WordPress Function

The register_term_meta() function is used to register metadata for terms in a taxonomy. This function can be used to store information about a term, such as an image or description. The register_term_meta() function takes two arguments: the taxonomy name and an array of metadata fields. The array of metadata fields must include at least one field with the 'type' key set to 'string'.

register_term_meta( string $taxonomy, string $meta_key, array $args ) #

Registers a meta key for terms.


Parameters

$taxonomy

(string)(Required)Taxonomy to register a meta key for. Pass an empty string to register the meta key across all existing taxonomies.

$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.


Top ↑

Return

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


Top ↑

Source

File: wp-includes/taxonomy.php

function register_term_meta( $taxonomy, $meta_key, array $args ) {
	$args['object_subtype'] = $taxonomy;

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


Top ↑

Changelog

Changelog
VersionDescription
4.9.8Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More