SOLVED: Query Loop with Load More via Interactions

Browser: Chrome Version 123.0.6312.122 (Official Build) (64-bit), Brave
Version 1.64.122 Chromium: 123.0.6312.122 (Official Build) (64-bit)
OS: Windows / Linux
URL: Link to a page that illustrates this issue
Video: none
We sort archives of CPT partner via pre_get_post (Pre Get Post CPT Partner · GitHub) and display them via query loop with “Is Main Query” on as only setting. This is working as expetcted for paginations.

However, if whe try to load more via Button with Interacrions set to
the button does nothing.

If we target the specific Query Loop in “Query” instead of the Main Query, random posts are loaded ignoring our pre_get_post setup.

Hi @cube ,

Thanks for checking with us.
Please note that Load More / Ajax Query / Infinite scroll in Bricks are using REST endpoints.
Hence, no main query will be detected.

To achieve what you want, you could use bricks/posts/query_vars PHP filter instead of pre_get_posts.

Kindly try this :slight_smile: (Just target the query via $element_id will do, no need to check is_main_query)


Thanks for pointing me in the right direction, Jenn. The query_vars filter is working great for “Load More”.

Best wishes