Getting Posts By Taxonomy Or Meta Field With WP-API v2.0

Mar 03, 2016 UPDATED:

Updated all routes in this post so now should be compatible with WP API V2 beta 12.

Feb 28, 2016 UPDATED: 

Just realised since v2 beta 4, /posts WP_Query vars was moved back to filter param. I'll update all routes in this post ASAP.

In the post adding fields to the JSON response of the WP REST API, you’ve learned about how to manipulate the data from the WP REST API (WP-API). Another topic I got asked very often, is how to get posts by certain filters – mostly taxonomy and meta field. So today let’s talk about it.

Before we get started, if you’re looking for the workarounds for WP-API v1.x, Josh has written great tutorials for you. Here are the links of them:

  1. Working with Taxonomies Using the JSON REST API
  2. Working with Meta Data Using the JSON REST API

In the following article, I’ll show you the quick answers and a more bigger picture beyond them. If you’re not interested in the later one, feel free to skip it.

Read more

Counting Posts In WordPress

Every now and then you would need to display the total post count in your WordPress application (website). There are several methods you can use for such a simple task, but can you tell the difference and choose the right method (function) which runs faster and consumes less resources? I’d like to share my findings with you in this post.

Read more