I can run an SQL query like ORDER BY FIELD( id, 3, 2, 1, 4 ), title and return a list of posts starting with my ids 3,2,1,4 and the continuing with the rest of a query, bringing back all remaining posts.

I'm trying to figure out if it's possible to make something similar to sticky posts.


I've got an ACF field attached to an archive page. This field allows you to choose IDs of posts in this archive.

I want to modify the archive loop to priorities the ACF IDs (Treat this as an array)

Ideally, I don't want to run a query twice to get the same details, but it's my only option at the moments.

Running a post__in loop followed by a post__not_in, but having to deal with pagination. It's a bit of a headache.

Is there a way to directly modify a WP_Query object that forces an array of IDs to be the first results that respects pagination etc.

Your Answer

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

Browse other questions tagged or ask your own question.