Filter hook 'rest_route_for_term'

in WP Core File wp-includes/rest-api.php at line 3265

View Source

rest_route_for_term

Filter Hook
Description
Filters the REST API route for a term.

Hook Information

File Location wp-includes/rest-api.php View on GitHub
Hook Type Filter
Line Number 3265

Hook Parameters

Type Name Description
string $route The route path.
WP_Term $term The term object.

Usage Examples

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

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

Source Code Context

wp-includes/rest-api.php:3265 - How this hook is used in WordPress core
<?php
3260  	 * @since 5.5.0
3261  	 *
3262  	 * @param string  $route The route path.
3263  	 * @param WP_Term $term  The term object.
3264  	 */
3265  	return apply_filters( 'rest_route_for_term', $route, $term );
3266  }
3267  
3268  /**
3269   * Gets the REST API route for a taxonomy.
3270   *

PHP Documentation

<?php
/**
	 * Filters the REST API route for a term.
	 *
	 * @since 5.5.0
	 *
	 * @param string  $route The route path.
	 * @param WP_Term $term  The term object.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/rest-api.php
Related Hooks

Related hooks will be displayed here in future updates.