Filter hook 'pre_term_link'

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

View Source

pre_term_link

Filter Hook
Description
Filters the permalink structure for a term before token replacement occurs.

Hook Information

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

Hook Parameters

Type Name Description
string $termlink The permalink structure for the term's taxonomy.
WP_Term $term The term object.

Usage Examples

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

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

Source Code Context

wp-includes/taxonomy.php:4675 - How this hook is used in WordPress core
<?php
4670  	 * @since 4.9.0
4671  	 *
4672  	 * @param string  $termlink The permalink structure for the term's taxonomy.
4673  	 * @param WP_Term $term     The term object.
4674  	 */
4675  	$termlink = apply_filters( 'pre_term_link', $termlink, $term );
4676  
4677  	$slug = $term->slug;
4678  	$t    = get_taxonomy( $taxonomy );
4679  
4680  	if ( empty( $termlink ) ) {

PHP Documentation

<?php
/**
	 * Filters the permalink structure for a term before token replacement occurs.
	 *
	 * @since 4.9.0
	 *
	 * @param string  $termlink The permalink structure for the term's taxonomy.
	 * @param WP_Term $term     The term object.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/taxonomy.php
Related Hooks

Related hooks will be displayed here in future updates.