admin管理员组

文章数量:1134557

I am pulling in some data via the Rest API:

[]=3116&include[]=3249&include[]=3170&include[]=3416&include[]=3181&include[]=1857&include[]=3563

The data loads fine, but the order is out of whack.

I was expecting the first result to be ID '3116' as that's the first included id in my URL.

How do I pull in data orderd by the URL id?

I am pulling in some data via the Rest API:

https://example.com/wp-json/wp/v2/speaker?include[]=3116&include[]=3249&include[]=3170&include[]=3416&include[]=3181&include[]=1857&include[]=3563

The data loads fine, but the order is out of whack.

I was expecting the first result to be ID '3116' as that's the first included id in my URL.

How do I pull in data orderd by the URL id?

Share Improve this question edited Oct 31, 2023 at 19:03 Keith asked May 9, 2019 at 11:51 KeithKeith 1,5664 gold badges17 silver badges21 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

Add orderby=include to your GET request.

See the docs here:

https://developer.wordpress.org/rest-api/reference/posts/#arguments

本文标签: How to order WordPress Rest API data