Filter hook 'get_tags'

in WP Core File wp-includes/category.php at line 313

View Source

get_tags

Filter Hook
Description
Filters the array of term objects returned for the 'post_tag' taxonomy.

Hook Information

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

Hook Parameters

Type Name Description
WP_Term[]|int|WP_Error $tags Array of 'post_tag' term objects, a count thereof, or WP_Error if any of the taxonomies do not exist.
array $args An array of arguments. See {@see get_terms()}.

Usage Examples

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

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

Source Code Context

wp-includes/category.php:313 - How this hook is used in WordPress core
<?php
 308  		 *
 309  		 * @param WP_Term[]|int|WP_Error $tags Array of 'post_tag' term objects, a count thereof,
 310  		 *                                     or WP_Error if any of the taxonomies do not exist.
 311  		 * @param array                  $args An array of arguments. See {@see get_terms()}.
 312  		 */
 313  		$tags = apply_filters( 'get_tags', $tags, $args );
 314  	}
 315  
 316  	return $tags;
 317  }
 318  

PHP Documentation

<?php
/**
		 * Filters the array of term objects returned for the 'post_tag' taxonomy.
		 *
		 * @since 2.3.0
		 *
		 * @param WP_Term[]|int|WP_Error $tags Array of 'post_tag' term objects, a count thereof,
		 *                                     or WP_Error if any of the taxonomies do not exist.
		 * @param array                  $args An array of arguments. See {@see get_terms()}.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/category.php
Related Hooks

Related hooks will be displayed here in future updates.