Title: get posts from custom taxonomy
Last modified: August 31, 2016

---

# get posts from custom taxonomy

 *  [kuldeepsidhu88](https://wordpress.org/support/users/kuldeepsidhu88/)
 * (@kuldeepsidhu88)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/get-posts-from-custom-taxonomy/)
 * I want to get posts from custom taxonomy e.g. poets
 * `http://punjabireel.com/wp-json/wp/v2/poets`
    Above link gives me the details
   of poets.
 * `http://punjabireel.com/wp-json/wp/v2/posts?filter[poet]=poet-name`
    This gives
   the list of posts under passed poet name. This works for both poet name and slug.
   But I want to work it similar as categories and tags.
 * `http://punjabireel.com/wp-json/wp/v2/posts?filter[cat]=catId`
    Can we pass the
   poetId instead of name/slug to make it work like other taxonomies.
 * [https://wordpress.org/plugins/rest-api/](https://wordpress.org/plugins/rest-api/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [jancbeck](https://wordpress.org/support/users/jancbeck/)
 * (@jancbeck)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/get-posts-from-custom-taxonomy/#post-7210792)
 * The REST API is just an interface for the underlying WordPress functions. In 
   this case, whatever you pass as the `filter` parameter is just passed through
   as a query argument to [WP_Query](https://codex.wordpress.org/Class_Reference/WP_Query).
   Since WP_Query does not support the same syntax for custom taxonomies as it does
   for categories and tags, it is not possible to filter by term ID with a top-level
   argument. This is unlikely to change unless WP Core changes. In fact querying
   by taxonomy slug is deprecated since WP v3.1 and you should use `tax_query` instead.
   However, `tax_query` is currently not a supported filter argument of WP REST 
   API because it is considered slow. In order to use it you need to use the rest_query_vars
   filter like so
 *     ```
       add_filter( 'rest_query_vars', function( $vars ){
       	$vars[] = 'tax_query';
       	return $vars;
       } );
       ```
   
 * Your request URL would look like this:
 * [http://punjabireel.com/wp-json/wp/v2/posts?filter%5Btax_query%5D%5B0%5D%5Btaxonomy%5D=poet&filter%5Btax_query%5D%5B0%5D%5Bfield%5D=id&filter%5Btax_query%5D%5B0%5D%5Bterms%5D=3](http://punjabireel.com/wp-json/wp/v2/posts?filter%5Btax_query%5D%5B0%5D%5Btaxonomy%5D=poet&filter%5Btax_query%5D%5B0%5D%5Bfield%5D=id&filter%5Btax_query%5D%5B0%5D%5Bterms%5D=3)
 *  [jancbeck](https://wordpress.org/support/users/jancbeck/)
 * (@jancbeck)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/get-posts-from-custom-taxonomy/#post-7210793)
 * **Update**: there is a pull request pending that is going to solve this issue
   
   [https://github.com/WP-API/WP-API/pull/2380](https://github.com/WP-API/WP-API/pull/2380)
 * Once it is accepted into the plugin it will actually be possible to query posts
   like this
    [http://punjabireel.com/wp-json/wp/v2/posts?poets=3](http://punjabireel.com/wp-json/wp/v2/posts?poets=3)

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘get posts from custom taxonomy’ is closed to new replies.

 * ![](https://ps.w.org/rest-api/assets/icon-256x256.png?rev=1346297)
 * [WordPress REST API (Version 2)](https://wordpress.org/plugins/rest-api/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/rest-api/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/rest-api/)
 * [Active Topics](https://wordpress.org/support/plugin/rest-api/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/rest-api/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/rest-api/reviews/)

## Tags

 * [custom taxonomy](https://wordpress.org/support/topic-tag/custom-taxonomy/)
 * [posts](https://wordpress.org/support/topic-tag/posts/)

 * 2 replies
 * 2 participants
 * Last reply from: [jancbeck](https://wordpress.org/support/users/jancbeck/)
 * Last activity: [10 years, 1 month ago](https://wordpress.org/support/topic/get-posts-from-custom-taxonomy/#post-7210793)
 * Status: not resolved