wpseek.com
Uma área de pesquisa sobre o WordPress para devs e autores do tema
rest_get_route_for_taxonomy_items › WordPress Function
Desde5.9.0
Obsoleton/a
› rest_get_route_for_taxonomy_items ( $taxonomy )
| Parâmetros: |
|
| Retorna: |
|
| Definido em: |
|
| Codex: |
Gets the REST API route for a taxonomy.
Funções relacionadas: rest_get_route_for_post_type_items, rest_get_route_for_term, rest_get_route_for_post, get_the_taxonomies, get_post_taxonomies
Fonte
function rest_get_route_for_taxonomy_items( $taxonomy ) {
$taxonomy = get_taxonomy( $taxonomy );
if ( ! $taxonomy ) {
return '';
}
if ( ! $taxonomy->show_in_rest ) {
return '';
}
$namespace = ! empty( $taxonomy->rest_namespace ) ? $taxonomy->rest_namespace : 'wp/v2';
$rest_base = ! empty( $taxonomy->rest_base ) ? $taxonomy->rest_base : $taxonomy->name;
$route = sprintf( '/%s/%s', $namespace, $rest_base );
/**
* Filters the REST API route for a taxonomy.
*
* @since 5.9.0
*
* @param string $route The route path.
* @param WP_Taxonomy $taxonomy The taxonomy object.
*/
return apply_filters( 'rest_route_for_taxonomy_items', $route, $taxonomy );
}