Support » Plugin: WordPress REST API (Version 2) » Getting custom taxonomy terms

  • Resolved Morgan Kay

    (@gwendydd)


    I’m trying to retrieve a list of taxonomy terms from a site.

    This successfully returns the taxonomy information:
    <site-url>/wp-json/wp/v2/taxonomies/creator/

    However, this:
    <site-url>/wp-json/wp/v2/taxonomies/creator/terms/
    gives me a 404. I know that there are terms in this taxonomy.

    What am I doing wrong here?

    https://wordpress.org/plugins/rest-api/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Daniel Bachhuber

    (@danielbachhuber)

    Can you share the code you’ve used to register the custom taxonomy? And, just to confirm, you’re running Beta 9?

    Thread Starter Morgan Kay

    (@gwendydd)

    Here’s the code that creates the custom taxonomy: http://pastebin.com/3miLwDrz

    I am running Beta 9.

    Thanks!

    Thread Starter Morgan Kay

    (@gwendydd)

    This is a multisite, if that makes any difference…..

    Plugin Author Daniel Bachhuber

    (@danielbachhuber)

    In Beta 9, we changed the behavior of taxonomies to live at top-level routes.

    Given your registration code, the creator terms endpoint should live at <site-url>/wp-json/wp/v2/creator/. I’ve installed your code snippet locally and verified this is the case for me.

    Also, if you’re ever in doubt as to which endpoints a site supports, you can visit <site-url>/wp-json/ for the full list.

    Thread Starter Morgan Kay

    (@gwendydd)

    Yep, that does it! Easy peasy. 🙂

    Thanks for letting me know about the list of endpoints – that’s really helpful.

    Thread Starter Morgan Kay

    (@gwendydd)

    I have a follow-up question… I’m using WP 4.4’s fancy new term meta, and it looks like the REST API doesn’t pick that up. Is there a way to access term meta with the REST API?

    Plugin Author Daniel Bachhuber

    (@danielbachhuber)

    Is there a way to access term meta with the REST API?

    Not without a bit of extra code at this time. You’ll need to use register_rest_field(), see http://v2.wp-api.org/extending/modifying/

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Getting custom taxonomy terms’ is closed to new replies.