hey john, thanks for the tenacity here!
so yes, i was surprised too, but this is from the last email i got on that subject from ACF support:
I have verified the issue with pre_get_posts. Unfortunately, there is no workaround for the same at the moment.
The only option would be to replace the implementation of the ‘pre_get_posts’ with an alternative.
We have had quite a number of similar cases and the developer is already aware of this issue.
so yes, as precisely as i can – i have a static homepage at http://veggiemagnifique.com which contains two loops, one to show the most recent post in its entirety, and another to show extracts from the next four, totalling the most recent five posts.
i have then been trying to begin the blog archives at http://veggiemagnifique.com/blog with an offset of 5, designated within wordpress as the posts page. it’s important that this query is paginated. right now it goes back to the most recent post and starts from there. adding an offset to the query as i’ve done on the homepage would break pagination, and as we’ve discovered, adding one in the way WP suggest, via pre_get_posts has so far offset all repeater fields across the site, although it has had the effect i wanted with regard to offset and pagination on the blog.
with the exception of the homepage we’re showing 16 posts per page. this is because the layout on the category pages requires it (although i could conceivably alter the queries in the category template to keep this number there if the WP settings were changed).
the reason i haven’t done what you suggest, although i follow the logic clearly, is because the homepage displays the first post differently to the others. my instinct was to create a bespoke loop for that. maybe there’s a better way to target only the first post in a loop?
if i could do that i wouldn’t even need the 301 redirect i think, i could just make the posts page the homepage and it would be page 1 of the blog.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2022 Advanced Custom Fields.