Skip to content

Query loop infinite loop when inheriting query from template #43198

@ebinnion

Description

@ebinnion

Description

This originally presented as a bug on WordPress.com where pages would not load at all in some occasions and was reported here:

Automattic/wp-calypso#66270

High-level, the issue is that in #40656 we changed how we handled the inherit query from template logic. Instead of pulling args out of the template query and then creating a new query object. We actually began to use the template query.

When we then call have_posts and hit the end of the loop within the block rendering, this resets the query while we're still in the block, and we're never able to pass the have_posts check in the template.

Step-by-step reproduction instructions

See Automattic/wp-calypso#66270 (comment)

Screenshots, screen recording, code snippet

No response

Environment info

  • Tested against most recent 13.8.1 as well as 13.8.0
  • Presents in WordPress.com and self-hosted sites.
  • Presents when using the Gutenberg plugin combined with a non site editor theme, such as TwentyTwentyOne

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Metadata

Metadata

Assignees

Labels

[Block] Query LoopAffects the Query Loop Block[Priority] HighUsed to indicate top priority items that need quick attention[Type] BugAn existing feature does not function as intended

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions