Filter hook 'rest_route_for_post_type_items'

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

View Source

rest_route_for_post_type_items

Filter Hook
Description
Filters the REST API route for a post type.

Hook Information

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

Hook Parameters

Type Name Description
string $route The route path.
WP_Post_Type $post_type The post type object.

Usage Examples

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

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

Source Code Context

wp-includes/rest-api.php:3231 - How this hook is used in WordPress core
<?php
3226  	 * @since 5.9.0
3227  	 *
3228  	 * @param string       $route      The route path.
3229  	 * @param WP_Post_Type $post_type  The post type object.
3230  	 */
3231  	return apply_filters( 'rest_route_for_post_type_items', $route, $post_type );
3232  }
3233  
3234  /**
3235   * Gets the REST API route for a term.
3236   *

PHP Documentation

<?php
/**
	 * Filters the REST API route for a post type.
	 *
	 * @since 5.9.0
	 *
	 * @param string       $route      The route path.
	 * @param WP_Post_Type $post_type  The post type 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.