Filter hook 'category_link'

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

View Source

category_link

Filter Hook
Description
Filters the category link.

Hook Information

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

Hook Parameters

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

Usage Examples

Basic Usage
<?php
// Hook into category_link
add_filter('category_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:4732 - How this hook is used in WordPress core
<?php
4727  		 * @since 5.4.1 Restored (un-deprecated).
4728  		 *
4729  		 * @param string $termlink Category link URL.
4730  		 * @param int    $term_id  Term ID.
4731  		 */
4732  		$termlink = apply_filters( 'category_link', $termlink, $term->term_id );
4733  	}
4734  
4735  	/**
4736  	 * Filters the term link.
4737  	 *

PHP Documentation

<?php
/**
		 * Filters the category link.
		 *
		 * @since 1.5.0
		 * @since 2.5.0 Deprecated in favor of {@see 'term_link'} filter.
		 * @since 5.4.1 Restored (un-deprecated).
		 *
		 * @param string $termlink Category 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.