'Wordpress Block Query Loop ID?
I've created a Query Loop on a Post. It works fine. If I change to Code Editor, I see there is a queryId:{int} which is generated. I'm wondering where that int id is coming from each time I add a new Query Loop. I have looked in the db to no avail (yet).
Why I'm asking. I am duplicating a post with that same Query Loop. When duplicated, the queryId remains the same. And it seems to be okay that I change the filtering (as in it doesn't change the filtering on the original that I duplicated from). The config for the query itself is in the Post ... which again makes me wonder why it needs this id?
I have assigned a random {int} too to see if that would break things, but it didn't.
Any idea where that id is stored in the db?
Solution 1:[1]
The queryId attribute is used to differentiate multiple query loop blocks on the same page for pagination. When you go to the next page using a pagination block in the query loop block, the queryId is included in the URL query (?query-{id}-page=2) to tell wordpress which query loop block you want the next page of. The ID is generated when the block is created, and stored only in the block attributes (the comments you see in code view), not in the database.
So yes, it SHOULD be different for each query loop block on a page if you expect pagination to work for each of them independently.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Daniel Vena |
