Query block display broken after copy-pasted from template to page

** Cwicly Plugin version: **


After moving (with copy-paste) a query block from frontpage template to a page, query display seems to be broken on the page with strange additional markup (kind of debug string?):

EDIT: Display looks fine inside the editor, issue only occurs on frontend.

(Query displays some CPT posts.)

Hello @yankiara,

Thanks for the report.

This does seem unusual, those are markers we use, but they should not appear once the block is rendered.
I notice Gutenberg html comments also appearing in the markup.
Is this content being displayed through a Post Content block or using a different method?

Thanks in advance and apologies for the inconvenience.


Good catch @Louis, I was using the_content() in a code block, but using the post content block solved the issue :slight_smile:

But why??? I guess it is a question of WP loop, but this is not very clear to me.
And why is it working in a template?
Is it because of nested loops? (first one to get the page, second one inside the page content)

Besides, now I have PHP warnings because rwmb_get_value() MetaBox function return NULL for items in my query, although they are correctly displayed.

There are 8 warnings, corresponding to the total number of posts, and I only display 3, and the values get by rwmb_get_value() are correct on the 3 output posts, despite the warnings.

Is there a first loop outside the loop??? ( :brain: :boom: )

I solved this by protecting NULL return value in my custom function and returning empty, but it is a real pain not to be able to directly access common loop functions…

I always have a hard time messing with the WP loop :wink: