rest_route_for_post_type_items filter-hookWP 5.9.0

Filters the REST API route for a post type.

Usage

add_filter( 'rest_route_for_post_type_items', 'wp_kama_rest_route_for_post_type_items_filter', 10, 2 );

/**
 * Function for `rest_route_for_post_type_items` filter-hook.
 * 
 * @param string       $route     The route path.
 * @param WP_Post_Type $post_type The post type object.
 *
 * @return string
 */
function wp_kama_rest_route_for_post_type_items_filter( $route, $post_type ){

	// filter...
	return $route;
}
$route(string)
The route path.
$post_type(WP_Post_Type)
The post type object.

Changelog

Since 5.9.0 Introduced.

Where the hook is called

rest_get_route_for_post_type_items()
rest_route_for_post_type_items
wp-includes/rest-api.php 3126
return apply_filters( 'rest_route_for_post_type_items', $route, $post_type );

Where the hook is used in WordPress

Usage not found.