Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
bacoords opened this issue Nov 29, 2023 · 1 comment
Labels
[Block] Post Template Affects the Post Template Block [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed [Type] Bug An existing feature does not function as intended

Comments

@bacoords
Copy link
Contributor

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

@bacoords bacoords added the [Type] Bug An existing feature does not function as intended label Nov 29, 2023
@t-hamano
Copy link
Contributor

Thanks for the report.

I think this issue was resolved in #56439. This fix will ship as part of version 17.2 of the Gutenberg plugin. I'll close this issue, but if this problem still occurs with Gutenberg plugin version 17.2, I'd appreciate it if you could comment again.

@t-hamano t-hamano closed this as not planned Won't fix, can't repro, duplicate, stale Nov 29, 2023
@t-hamano t-hamano added [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed [Block] Post Template Affects the Post Template Block labels Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Post Template Affects the Post Template Block [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed [Type] Bug An existing feature does not function as intended
2 participants