Multiple query loop blocks and exclude already inserted posts

[ad_1]

Hi, I’m having some trouble dealing with a request: in a page (likely the homepage) I have multiple query loop blocks, each one filtering by some different taxonomies like categories, tags and so on.

I want to be able to track what are the posts that each blocks (in order from first in the page to the last) extract to filtering the other blocks query from extracting the same posts.

For example:

* Post A is in category “sport” and has a tag “soccer”

If I put on my page a query loop block to extract posts from category “sport” and then another query loop block that extract post with the tag “soccer” I only want post A to be on the first loop block (since it’s the 1st added in the page).

I tried using a global array and filtering on pre\_get\_posts only for core/query block type with no luck (I don’t think I can use some render\_blocks hook since when it’s rendering the query is already been made right?). Some help on how can I do?
It’s something that has to deal with “communication within blocks” I suppose… Thanks!

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer