Is it possible to query the API directly using a tag slug rather than a tag ID? Or do you have to query the main tags endpoint to find out its ID?

For reference, you can fetch a tag this way:

GET /wp/v2/tags/


Does core support a method that would allow me to use a slug instead of an ID? Or is there a workaround/filter addition that might add this?

1 Answer 1


I was looking at this before... Here is what I found (about 7 months old from today 3/21/2018.)

The “correct” way to do this with the REST API is to get the IDs of each of those tags, then make the request using the ?tags= parameter: assuming “clicks” has ID 1, and “passes” has ID 2, that would look like this


Using slugs for querying taxonomy terms is an issue, but slug-based queries were deliberately left out of core because they are more prone to change than taxonomy term IDs. To demonstrate the issue, if you renamed a slug and made a request with an outdated slug, your request will fail; but if you use the ID, changing the slug will not break your query.

You can get the ID of a slug by querying for e.g. /wp/v2/tags?slug=clicks

  • Most of this answer isn't relevant to the question, but the last sentence on its own is literally the canonical answer
    – Tom J Nowell
    Mar 21, 2018 at 23:36
  • 1
    Thanks Tom, I've been docked before for not providing enough information...just trying to give back to the group.
    – rudtek
    Mar 22, 2018 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.