1
votes

I am working with the REST API by Wordpress and I am trying to get the tags from the site and sort them in descending order by count. However, I am not getting all the respective tags nor are they being sorted.

I noticed some posts that talked about a JSON API, but the plugin doesn't exist anymore. Is there a way I can retrieve all data through the REST API?

For instance: http://example.org/wp-json/wp/v2/tags?order=desc

Thanks

1
@FluffyKitten I beg your pardon. But my question is much different. The linked post is experiencing problems with the amount of data. I am having issues with getting the right data in the respective orderrobot13

1 Answers

2
votes

The problem with your example there is you aren't giving the attribute it needs to sort. So while it does know that it needs to sort the tags in desc order, you'll have to specify the orderby attribute.

So something like:

http://example.org/wp-json/wp/v2/tags?orderby=count&order=desc

This would list out the tags in descending order by their count.