Filter hook 'get_term'

in WP Core File wp-includes/taxonomy.php at line 1021

View Source

get_term

Filter Hook
Description
Filters a taxonomy term object. The {@see 'get_$taxonomy'} hook is also available for targeting a specific taxonomy.

Hook Information

File Location wp-includes/taxonomy.php View on GitHub
Hook Type Filter
Line Number 1021

Hook Parameters

Type Name Description
WP_Term $_term Term object.
string $taxonomy The taxonomy slug.

Usage Examples

Basic Usage
<?php
// Hook into get_term
add_filter('get_term', 'my_custom_filter', 10, 2);

function my_custom_filter($_term, $taxonomy) {
    // Your custom filtering logic here
    return $_term;
}

Source Code Context

wp-includes/taxonomy.php:1021 - How this hook is used in WordPress core
<?php
1016  	 * @since 4.4.0 `$_term` is now a `WP_Term` object.
1017  	 *
1018  	 * @param WP_Term $_term    Term object.
1019  	 * @param string  $taxonomy The taxonomy slug.
1020  	 */
1021  	$_term = apply_filters( 'get_term', $_term, $taxonomy );
1022  
1023  	/**
1024  	 * Filters a taxonomy term object.
1025  	 *
1026  	 * The dynamic portion of the hook name, `$taxonomy`, refers

PHP Documentation

<?php
/**
	 * Filters a taxonomy term object.
	 *
	 * The {@see 'get_$taxonomy'} hook is also available for targeting a specific
	 * taxonomy.
	 *
	 * @since 2.3.0
	 * @since 4.4.0 `$_term` is now a `WP_Term` object.
	 *
	 * @param WP_Term $_term    Term object.
	 * @param string  $taxonomy The taxonomy slug.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/taxonomy.php
Related Hooks

Related hooks will be displayed here in future updates.