Skip to content

Query Loop: "Per_page" value is being appended to "offset" on the backend fetch call #56650

Closed as not planned
@bacoords

Description

@bacoords

Description

When using a query loop block on a vanilla WP with Gutenberg plugin activated (on v17.1.3), the query loop often returns empty. If you dig into the REST API calls in your browser, you can see that the offset value is actually being passed the per_page + offset, so instead of offset=0&per_page=12, you end up with offset=120&per_page=12

Step-by-step reproduction instructions

  1. Launch a new WP install
  2. Install Gutenberg v17.1.3
  3. Add the query loop or modify the main page template (you'll need to disable the 'inherit query from template' setting)
  4. Mess with any of the pagination settings, per page, offset, etc. Then watch the network tab for the /posts/ endpoint.

Screenshots, screen recording, code snippet

Screenshot 2023-11-29 at 7 19 57 AM

Environment info

  • WP 6.4.1
  • Gutenberg 17.1.3
  • Any theme (I used TT4)
  • Tested in PHP 8.0 and 8.1

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

No one assigned

    Labels

    [Block] Post TemplateAffects the Post Template Block[Status] DuplicateUsed to indicate that a current issue matches an existing one and can be closed[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions