By using WordPress REST Api
./wp/v2/users/?_fields=id&orderby=id&order=desc
Result
[{"id":13},{"id":12},{"id":11},{"id":10},{"id":9},{"id":8},{"id":6},{"id":5},{"id":4},{"id":3}]
What I want?
I just want to display [{“id”:13},
Means, I want to limit it to only 1 array Using REST API. Any one have solution on this?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
The docs show that you can do paging with page and per_page, so looks like you should be able to set per_page to 1 and leave page unset to get a single result. i.e.:
./wp/v2/users/?_fields=id&orderby=id&order=desc&per_page=1
Does that help?
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0