UPDATED March 03, 2016:
Post has been updated. Now we use "rest_prepare_category" filter for this job.
UPDATED March 02, 2016:
With the latest WP API V2 Beta12, the filter "
rest_prepare_term" I used in this post no longer work and it should be changed to "
rest_prepare_category". I'll update the post content ASAP.
A while back ago I wrote a post to show you how to “Adding Fields To The JSON Response Of The WP REST API“. In the first scenario why we’ll ever need to add fields to WP API, is for people who want to build an accordion menu with categories as the first level links, which when being clicked, the posts would be collapsed as the second level links.
We know we could use WP API to get a single category info, and we can also get the posts for a certain category, but unfortunately we can’t do both in a single API request. Read More…
I’m a senior web developer helping clients build their websites to grow businesses. Currently I’m based in Taipei, Taiwan.
I write things about WordPress, AngularJS and life. Whenever you’d like to find someone to talk about these topics, just get in touch!