Registers a meta key for terms.
Parameters
$taxonomy
stringrequired- Taxonomy to register a meta key for. Pass an empty string to register the meta key across all existing taxonomies.
$meta_key
stringrequired- The meta key to register.
$args
arrayrequired- Data used to describe the meta key when registered. See register_meta() for a list of supported arguments.
Source
function register_term_meta( $taxonomy, $meta_key, array $args ) {
$args['object_subtype'] = $taxonomy;
return register_meta( 'term', $meta_key, $args );
}
Changelog
Version | Description |
---|---|
4.9.8 | Introduced. |
Using this function with a specified schema makes its value available both in queries to get the value on the taxonomy and in the schema available through a request with OPTIONS method to the same endpoint.
Notes:
– It is currently documented only for non scalar values (array and objects), but it’s valid using it for single values also.
– It is available from version version 4.9.8
In WP Core, `register_meta() ` is only used by `register_post_meta` and `register_term_meta() `, and otherwise none of these functions are used in Core.
Jetpack uses `register_post_meta() `, and `register_meta() ` for ‘post’ and ‘user’, but not `register_term_meta() `.