Filter hook 'get_the_tags'

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

View Source

get_the_tags

Filter Hook
Description
Filters the array of tags for the given post.

Hook Information

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

Hook Parameters

Type Name Description
WP_Term[]|false|WP_Error $terms Array of WP_Term objects on success, false if there are no terms or the post does not exist, WP_Error on failure.

Usage Examples

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

function my_custom_filter($terms) {
    // Your custom filtering logic here
    return $terms;
}

Source Code Context

wp-includes/category-template.php:1190 - How this hook is used in WordPress core
<?php
1185  	 * @see get_the_terms()
1186  	 *
1187  	 * @param WP_Term[]|false|WP_Error $terms Array of WP_Term objects on success, false if there are no terms
1188  	 *                                        or the post does not exist, WP_Error on failure.
1189  	 */
1190  	return apply_filters( 'get_the_tags', $terms );
1191  }
1192  
1193  /**
1194   * Retrieves the tags for a post formatted as a string.
1195   *

PHP Documentation

<?php
/**
	 * Filters the array of tags for the given post.
	 *
	 * @since 2.3.0
	 *
	 * @see get_the_terms()
	 *
	 * @param WP_Term[]|false|WP_Error $terms Array of WP_Term objects on success, false if there are no terms
	 *                                        or the post does not exist, WP_Error on failure.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/category-template.php
Related Hooks

Related hooks will be displayed here in future updates.