term_<field>
Filters the term field sanitized for display.
Description
The dynamic portion(s) of the filter name, $field
,, refers to the term field name.
Parameters (4)
- 0. $value (mixed)
- Value of the term field.
- 1. $term_id (int)
- The term id.
- 2. $taxonomy (string)
- Taxonomy slug.
- 3. $context (string)
- Context to retrieve the term field value.
Usage
- To run the hook, copy the example below.
- $value = apply_filters( 'term_{$field}', $value, $term_id, $taxonomy, $context );
- if ( !empty( $value ) ) {
- // everything has led up to this point...
- }
- The following example is for adding a hook callback.
- // define the term_<field> callback
- function filter_term_field( $value, $term_id, $taxonomy, $context ) {
- // make filter magic happen here...
- return $value;
- };
- // add the filter
- add_filter( "term_{$field}", 'filter_term_field', 10, 4 );
- To remove a hook callback, use the example below.
- // remove the filter
- remove_filter( "term_{$field}", 'filter_term_field', 10, 4 );
Defined (1)
The filter is defined in the following location(s).
- /wp-includes/taxonomy.php
- $value = apply_filters( "term_{$field}", $value, $term_id, $taxonomy, $context );