Query loop issue
-
In “query loop” block, after selecting “inherit query from template” query result works as if I had selected “offset”. I can’t see 1st post of every query (in search results page or on archives). How can I fix the issue?
-
This topic was modified 2 years, 5 months ago by
spello.
-
This topic was modified 2 years, 5 months ago by
-
Hi @spello, that definitely sounds very unusual. There’s a couple of things that would be helpful to know to help troubleshoot.
- Do you have a link to the site where I can check it out as a visitor?
- Do you have any other plugins active? Does the issue still occur when you have them deactivated?
- It sounds as though this Query Loop block is in one (or some) of your templates – could you please confirm which ones?
Hello.
No, I don’t use additional plugins.
I use custom template for archives and search pages.
I’d be happy to send you a link but would like to do it via PM. How can I do that?Hi @spello – if you open the the template for the archive or search page within the Site Editor (Appearance > Editor) you can then click the button with three dots at top right of the editor – and select ‘Copy all Blocks’ from the menu that appears.

Once you’ve done that – you can paste it into a
/codeblock within the editor in the forums here – and I can check it out.Okay. Here is the code for “search” template: https://pastebin.com/VkbRxner
Hey @spello – thanks for that. I tried out that template and I can’t seem to recreate the issue.
Do you still have that issue occuring if you switch to another theme like TwentyTwentyTwo? Or only with this one?
The only other thing I can think is if one of the Template Parts/Areas you have (which didn’t come through in what you shared) might be impacting in some way. You could try that template with those removed to see if it makes a difference.
Hello. Query from both search and archive templates works properly after removing left sidebar template part. Here is its code: https://pastebin.com/dVbtzPGy
Nice detective work @spello – we’re definitely narrowing down the issue…
I see there’s a few query loops in that sidebar – so the next thing I’d suggest is trying out the template with those sidebar query loops removed one by one – to narrow it down further.
It works only if I remove all queries from this sidebar.
Hmmm – ok thanks for trying that out. One other question I have – had you dupicated any of the Query Loop blocks to then adjust into the new queries? Or were all those queries created new?
Hey. Yes most of these blocks were surely duplicated and then adjusted.
Hey. Yes most of these blocks were surely duplicated and then adjusted.
OK – that’s good to know. It’s possible that having those duplicated could be impacting the way they interact. If you edit that sidebar template part and then click the three-dots at the top-right to view the HTML version.
You’ll see that each Query Loop contains an ID – could you please make sure that each of those is different?
I have changed IDs to be unique on every query block on sidebars but with no effect.
Hey @spello – thanks for trying that out. To be honest – I’m a little unsure beyond that what might be causing the issue…
One other thing I can think of is if any of the sidebar queries are using ‘inherit query from Template’ in case that is conflicting – that could be worth checking.
The topic ‘Query loop issue’ is closed to new replies.
