Divi WordPress Theme
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WordPress fix Tag rest api

Discussion in 'Misc WordPress Requests' started by WordPress.org Forums », Dec 9, 2017.

  1. WordPress.org Forums »

    Guest

    Tag rest api, by

    GET wp/v2/tags returns a list of tags (20 by default) but there is no information about how many tags there are in totals. The only way I found to get all the tags is to issue multiple requests with the page parameter in the query string until I get a response with an empty array. Is there any other elegant solution?

    POST wp/v2/tags will return 409 if a tag already exists, but there are no other information about the tag itself, like the id:

    {
    "code": "term_exists",
    "message": "A term with the name provided already exists in this taxonomy.",
    "data": {
    "status": 409
    }
    }

    The GET API only works with id, it doesn’t work passing a tag name. The only way I found to solve this is to prefetch all the tags with ids, store them in memory and check if the tag already exists before doing a POST request.
    Again, is there any other way, a more efficient one, to solve this issue?

    Thanks

    Tag rest api
     
    #1

Share This Page

Monarch Social Sharing Plugin