the_terms
Filters the list of terms to display.
Description
apply_filters( 'the_terms', (array) $term_list, (string) $taxonomy, (string) $before, (string) $sep, (string) $after );
Parameters (5)
- 0. $term_list (array)
- List of terms to display.
- 1. $taxonomy (string)
- The taxonomy name.
- 2. $before (string)
- String to use before the terms.
- 3. $sep (string)
- String to use between the terms.
- 4. $after (string)
- String to use after the terms.
Usage
- To run the hook, copy the example below.
- $term_list = apply_filters( 'the_terms', $term_list, $taxonomy, $before, $sep, $after );
- if ( !empty( $term_list ) ) {
- // everything has led up to this point...
- }
- The following example is for adding a hook callback.
- // define the the_terms callback
- function filter_the_terms( $term_list, $taxonomy, $before, $sep, $after ) {
- // make filter magic happen here...
- return $term_list;
- };
- // add the filter
- add_filter( 'the_terms', 'filter_the_terms', 10, 5 );
- To remove a hook callback, use the example below.
- // remove the filter
- remove_filter( 'the_terms', 'filter_the_terms', 10, 5 );
Defined (1)
The filter is defined in the following location(s).
- /wp-includes/category-template.php
- echo apply_filters( 'the_terms', $term_list, $taxonomy, $before, $sep, $after );