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

WP Query: Incorrect routing of pagination when place 2 different blocks in a same page #44019

Closed
x4fingers opened this issue Sep 9, 2022 · 4 comments
Labels
[Block] Query Loop Affects the Query Loop Block [Block] Query Pagination Affects the Query Pagination Block - used for pagination within the Query Loop Block [Type] Bug An existing feature does not function as intended

Comments

@x4fingers
Copy link

Description

Current pagination routing doesn't have a way to classify multiple post categories on the same page.

What happened:
An example, I'm on the a custom page which places 2 WP Query blocks for 2 different post categories. If I click on the second page number or the next button of the first category, I will go to the second page, it shows posts of both the first category and the second category.

What I expect:
I expect will go to the second page but it only shows the first category's posts (routing need to changed), or go to the selected Category page.

Step-by-step reproduction instructions

  1. Create 2 different dummy categories and their dummy posts.
  2. Create a new custom page with Block editor and add WP Query block for 2 categories.
  3. Click on the second page number link or Next link.

Screenshots, screen recording, code snippet

No response

Environment info

  • Wordpress 6.0.2

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

@carolinan carolinan added [Block] Query Loop Affects the Query Loop Block [Block] Query Pagination Affects the Query Pagination Block - used for pagination within the Query Loop Block [Type] Bug An existing feature does not function as intended labels Sep 9, 2022
@ntsekouras
Copy link
Contributor

👋 - Can you elaborate a bit more? I don't understand the issue you're experiencing.

I have inserted two Query Loop blocks that show only posts from a specific category, different for each one. When I click on the next it will show the next page for the Query Loop block I clicked and preserve the existing page for any other Query Loop blocks, which is the expected behavior.

@x4fingers
Copy link
Author

@ntsekouras please take a look at my example page. If you click page 2 or next page of a random category you will understand what I'm describing.

@ntsekouras
Copy link
Contributor

@ntsekouras please take a look at my example page. If you click page 2 or next page of a random category you will understand what I'm describing.

Oh.. I think I got your problem now and I believe it's related to #29693, which we should revive. By checking your provided link I saw that both Query Loop blocks share the same queryId(19 in your case). This id is what is used in pagination blocks to make multiple blocks paginate properly. So my guess is you created the first Query Loop block and copied/duplicated for the other which also copied the id. Is my guess right?

For now, all you have to do is go to the page/template you have these queries and update manually the queryId in code editor, of one of the blocks that have the issue:

Screen.Recording.2022-10-18.at.8.27.25.AM.mov

@x4fingers
Copy link
Author

Thank you @ntsekouras. The problem is solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Query Loop Affects the Query Loop Block [Block] Query Pagination Affects the Query Pagination Block - used for pagination within the Query Loop Block [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

3 participants