How can I preserve relationship item order using WP_Query?
-
I have a simple meta query to get all related items for the current post, but the order of results returned is not as they are set in the admin. Since there doesn’t appear to be a way of ordering by
wp_postmeta.meta_id
(which I think could work) I have to use this approach instead, but it requires more database calls:$ids = pods()->field( 'foo', [ 'output' => 'ids' ] ) ?: [ 0 ];
return [
'post_type' => 'foo',
'posts_per_page' => -1,
'post__in' => $ids,
'order' => 'ASC',
'orderby'=> 'post__in'
];Is there a way to do the same just using a simple meta query?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.