Loop-position dynamic inserter causes fatal error when used in a nested query

Description:

Using the {loop-position} dynamic inserter in a nested query triggers a fatal error when loading the page.

Fatal error: Uncaught Error: Unsupported operand types: array - int
in /public_html/wp-content/plugins/cwicly/core/includes/dynamic/render.php on line 364

Step-by-step reproduction instructions:

  1. Open the Post Editor/Site Editor
  2. Create a query block
  3. Create a nested query block
  4. Create a paragraph block inside the nested query block and use {loop-position} dynamic inserter
  5. Save the page
  6. Load the page on the frontend

Screenshots, screen recording, code snippet

image

Environment info

  • WordPress version: 6.2.2
  • Cwicly Plugin version: 1.2.9.7.3

Hi @nadim,

Thank you for bringing this to our attention!

I have been able to reproduce this error on my end and can confirm it is a bug.
We’ll be sure to have a fix for this as soon as possible.

Apologies for the inconvenience caused.

No problem, @Araminta.

There is a workaround in the meantime using {loop-index} instead of {loop-position}.

Note: if anyone is using this workaround with pagination, the index of every first post on a page will be reset to 1. This may or may not be what you want.

1 Like

Hello @nadim,

Apologies for the trouble here, and thank you for the report.
This should be addressed in 1.2.9.8.
I’d be grateful if you could let me know if all is good on your end or if you’re still encountering issues with this specific issue.

Cheers,

Not sure how I missed answering @Luis . Yes, all working now on my side. Thanks!

1 Like