category_link
Filters the category link.
Usage
add_filter( 'category_link', 'wp_kama_category_link_filter', 10, 2 );
/**
* Function for `category_link` filter-hook.
*
* @param string $termlink Category link URL.
* @param int $term_id Term ID.
*
* @return string
*/
function wp_kama_category_link_filter( $termlink, $term_id ){
// filter...
return $termlink;
}
- $termlink(string)
- Category link URL.
- $term_id(int)
- Term ID.
Changelog
| Since 1.5.0 | Introduced. |
| Since 2.5.0 | Deprecated in favor of term_link filter. |
| Since 5.4.1 | Restored (un-deprecated). |
Where the hook is called
wp-includes/taxonomy.php 4758
$termlink = apply_filters( 'category_link', $termlink, $term->term_id );