rest_route_for_post
Filters the REST API route for a post.
Использование
add_filter( 'rest_route_for_post', 'wp_kama_rest_route_for_post_filter', 10, 2 );
/**
* Function for `rest_route_for_post` filter-hook.
*
* @param string $route The route path.
* @param WP_Post $post The post object.
*
* @return string
*/
function wp_kama_rest_route_for_post_filter( $route, $post ){
// filter...
return $route;
}
- $route(строка)
- The route path.
- $post(WP_Post)
- The post object.
Список изменений
| С версии 5.5.0 | Введена. |
Где вызывается хук
rest_route_for_post
wp-includes/rest-api.php 3205
return apply_filters( 'rest_route_for_post', $route, $post );