Get taxonomy by slug
See original GitHub issueIn the docs (frontpage) it says:
wp.taxonomies().taxonomy( 'taxonomy_name' ).term( termIdentifier ): get the term with slug or ID termIdentifier from the taxonomy taxonomy_name
This works with the ID, but not with the slug 😦. Is this something that changed?
HOST/wp-json/taxonomies/post_tag/terms/42 works HOST/wp-json/taxonomies/post_tag/terms/sociaal-ondernemerschap doesn’t
Issue Analytics
- State:
- Created 9 years ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
get_term_by() | Function - WordPress Developer Resources
get_term_by() returns a single WP_Term object. Because of core changes from v4.1 – 4.3, it's now possible for multiple terms to match the...
Read more >How to get a taxonomy term name by the slug?
The function you are looking for is get_term_by . You would use it as such: <?php $term = get_term_by('slug', 'my-term-slug', ...
Read more >Wordpress get taxonomy name with slug - Stack Overflow
WordPress does provide a function to get the taxonomy information from its slug. $taxonomy_details = get_taxonomy( $slug );.
Read more >How to Create Custom Taxonomies in WordPress - WPBeginner
Your first step is to create a slug for the taxonomy. This slug is used in the URL and in WordPress search queries....
Read more >Get The Slug and Name From Custom Taxonomy | John Hartley
$terms = get_the_terms( $post ->id, 'custom-taxonomy' ); // get an array of all the terms as objects. $term_slug = array (); // save...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The “slug” query parameter is now supported by the WordPress REST API for the
tags
andcategories
endpoints. https://github.com/WP-API/WP-API/issues/924In the intervening year, this has been broken again by the v2 beta upgrades: WP-API/WP-API#924 identifies that
filter
is not currently supported on the/categories
or/tags
endpoints.WP-API/WP-API#2065 has been opened to identify whether this will ever be reinstated; in the meantime, #126 will add a demonstration of using the
?search
parameter to slightly more efficiently retrieve a specific term by slug (basically the same “get them all and search for the one you want in the response” approach detailed above, but with less overhead due to the narrowing effect of?search=the-slug
).