wpseek.com
Outil de recherche WordPress pour les développeurs et auteurs de thèmes
rest_get_route_for_post › WordPress Function
Depuis5.5.0
Dépréciéen/a
› rest_get_route_for_post ( $post )
Paramètres: |
|
Retourne: |
|
Défini(e) dans: |
|
Codex: |
Gets the REST API route for a post.
Source
function rest_get_route_for_post( $post ) { $post = get_post( $post ); if ( ! $post instanceof WP_Post ) { return ''; } $post_type_route = rest_get_route_for_post_type_items( $post->post_type ); if ( ! $post_type_route ) { return ''; } $route = sprintf( '%s/%d', $post_type_route, $post->ID ); /** * Filters the REST API route for a post. * * @since 5.5.0 * * @param string $route The route path. * @param WP_Post $post The post object. */ return apply_filters( 'rest_route_for_post', $route, $post ); }