0

So, I've got a relationship field where I select a certain amount of posts to show on the home page. What I am trying to achieve is to apply the menu order of the posts as they are in the back end so that they appear in that order on the front end.

For example, the below screenshot is how the posts are ordered in the relationship field back end of ACF:

Menu Order - Back end

But on the front end, public facing, they appear in this order:

Post 1

Post 2

Post 3

Here's a sample of the query I'm using to show the relationship posts on the page in case that helps:

$ids = get_field('homepage_lineup_new', 'option', false, false); 

$query = new WP_Query(array(
'post_type'         => 'post',
'posts_per_page'    => 15,
'post__in'          => $ids
));

Thanks!

1

orderby defaults to post_date, to order by the IDs you supply, you have to orderby post__in

$ids = get_field('homepage_lineup_new', 'option', false, false); 

$query = new WP_Query(array(
'post_type'         => 'post',
'posts_per_page'    => 15,
'post__in'          => $ids
'orderby'           => 'post__in'
));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.