Conflict of two Query Loop Variation blocks on the same page. #62629
-
Hello, I found an article on the WordPress Block Development portal about creating a Query Loop Variation block. I followed that guide, and my two separate variation plugins seem to work individually, but not when both are used on the same page. When I add the second block, it starts to give me unexpected results for post sorting. However, when I disable one of the variations, everything works fine. Can someone tell me where I'm wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
This sounds like it might be the result of duplicate query IDs. There is an existing issue open about this #55823 but there is a manual way to work around it ; by manually changing the queryid of one of either loops in the code editor, on the page; you will have to do this for every page or template that has more than 1 query loop on it. |
Beta Was this translation helpful? Give feedback.
-
@skorasaurus Thank you, now I see, but I'm also just check my IDs of Query Loops in Code Editor, and they seem different, "queryId":2 and "queryId":6. I'm also change them to something random and this doesn't help me. Any other suggestions, may be create one plugin for two Query Loop variations, like 2in1? |
Beta Was this translation helpful? Give feedback.
-
@skorasaurus My IDs are not duplicating, so in this case, the problem was that I didn't check the |
Beta Was this translation helpful? Give feedback.
@skorasaurus My IDs are not duplicating, so in this case, the problem was that I didn't check the
queryId
of the block before adding a filter on thequery_loop_block_query_vars
hook. When I did that, the problem was gone. Thank you for trying to help.