Filter hook 'tag_link'

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

View Source

tag_link

Filter Hook
Description
Filters the tag link.

Hook Information

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

Hook Parameters

Type Name Description
string $termlink Tag link URL.
int $term_id Term ID.

Usage Examples

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

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

Source Code Context

wp-includes/taxonomy.php:4719 - How this hook is used in WordPress core
<?php
4714  		 * @since 5.4.1 Restored (un-deprecated).
4715  		 *
4716  		 * @param string $termlink Tag link URL.
4717  		 * @param int    $term_id  Term ID.
4718  		 */
4719  		$termlink = apply_filters( 'tag_link', $termlink, $term->term_id );
4720  	} elseif ( 'category' === $taxonomy ) {
4721  
4722  		/**
4723  		 * Filters the category link.
4724  		 *

PHP Documentation

<?php
/**
		 * Filters the tag link.
		 *
		 * @since 2.3.0
		 * @since 2.5.0 Deprecated in favor of {@see 'term_link'} filter.
		 * @since 5.4.1 Restored (un-deprecated).
		 *
		 * @param string $termlink Tag link URL.
		 * @param int    $term_id  Term ID.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/taxonomy.php
Related Hooks

Related hooks will be displayed here in future updates.