Filter hook 'get_{$taxonomy}'

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

View Source

get_{$taxonomy}

Filter Hook
Description
Filters a taxonomy term object. The dynamic portion of the hook name, `$taxonomy`, refers to the slug of the term's taxonomy. Possible hook names include: - `get_category` - `get_post_tag`

Hook Information

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

Hook Parameters

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

Usage Examples

Basic Usage
<?php
// Hook into get_{$taxonomy}
add_filter('get_{$taxonomy}', '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:1040 - How this hook is used in WordPress core
<?php
1035  	 * @since 4.4.0 `$_term` is now a `WP_Term` object.
1036  	 *
1037  	 * @param WP_Term $_term    Term object.
1038  	 * @param string  $taxonomy The taxonomy slug.
1039  	 */
1040  	$_term = apply_filters( "get_{$taxonomy}", $_term, $taxonomy );
1041  
1042  	// Bail if a filter callback has changed the type of the `$_term` object.
1043  	if ( ! ( $_term instanceof WP_Term ) ) {
1044  		return $_term;
1045  	}

PHP Documentation

<?php
/**
	 * Filters a taxonomy term object.
	 *
	 * The dynamic portion of the hook name, `$taxonomy`, refers
	 * to the slug of the term's taxonomy.
	 *
	 * Possible hook names include:
	 *
	 *  - `get_category`
	 *  - `get_post_tag`
	 *
	 * @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.