In edition to this post below:
wordpress json custom taxonomy problem
How to write a method for getting categories withing a custom taxonomy, similar to Method: get_category_index in core json api controller?
Scenario:
I have a taxonomy called – books which has four categories and i need those categories to be outputted through get_taxonomy_index.
Something like this http://example.com//api/get_taxonomy_index/?dev=1
To list terms of custom taxonomy in your case
books
we will need to create a custom controller for JSON API.Step 1: Following 2 classes should be paste in a php file stored in your theme directory (you can store the file whereever you like but then you will have to make sure you return the correct path of the file in code in Step 2). File name for this example is: json-api-taxonomy-index.php
Step 2: Paste the following filters in your functions.php file. If you haven’t stored the file in your theme directory then change the path of the file in
set_taxonomy_controller_path
function.Step 3: Goto
Settings->JSON API
and Activate taxonomy controller.Thats it you are done! Now you can access the terms of your custom taxonomy using the json api. Example: http://example.com/api/Taxonomy/get_taxonomy_index/?taxonomy=books