You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Anchor option for pagination in the Query Loop Block #50137
This is splitting the issues brought up in #48330 into two different ones.
What problem does this address?
When using pagination to navigate through the pages in a Query Loop block, the page reloads and moves the user back to the top of the page. This is a user experience issue.
What is your proposed solution?
Provide a toggle that, when active, tells WordPress to append an anchor ID to the pagination links. The toggle would be inactive by default which would not change the output of the block. This should, hopefully, allow existing custom solutions that modify the block's output to continue working.
When the toggle is active, default behavior would be to generate a unique anchor ID for the block based on post type, filters, and where it appears on the page. This anchor ID is then appended to the pagination links in the block. If the user wishes to use a custom anchor ID, they should be able to edit the block anchor ID and the anchor ID that's appended to the pagination code in their own fields.
Tested on trunk: the Query Loop block now has a per-block opt-in that keeps visitors at the block when they page through it. It's the Reload full page toggle under Advanced, added in #53812 and renamed in #65081. When it's off, the pagination links load the next page of posts in place, with no full page reload, so the page doesn't jump back to the top.
Test page: a 1500px spacer, then a Query Loop showing 1 post per page.
With Reload full page off, I scrolled down and clicked "Next Page". Page 2 loads in place, the URL updates, and the view stays at the Query Loop:
reload-off-stays-at-query.webm
With it on (the default), the same click reloads the page and lands at the top:
reload-on-back-at-top.webm
It isn't the anchor link the issue suggested, but it fixes what the issue describes (the jump back to the top) the same opt-in way. One limit: if the Query Loop has blocks that don't support it, such as some third-party blocks, the editor turns full reload back on and shows a notice.
Closing as done. If you need the anchor version specifically, for example for links shared from page 2, please say so and we can reopen.
Activity
masperber commentedon Mar 24, 2024
+1
ellatrix commentedon Nov 4, 2026
Tested on trunk: the Query Loop block now has a per-block opt-in that keeps visitors at the block when they page through it. It's the Reload full page toggle under Advanced, added in #53812 and renamed in #65081. When it's off, the pagination links load the next page of posts in place, with no full page reload, so the page doesn't jump back to the top.
Test page: a 1500px spacer, then a Query Loop showing 1 post per page.
With Reload full page off, I scrolled down and clicked "Next Page". Page 2 loads in place, the URL updates, and the view stays at the Query Loop:
reload-off-stays-at-query.webm
With it on (the default), the same click reloads the page and lands at the top:
reload-on-back-at-top.webm
It isn't the anchor link the issue suggested, but it fixes what the issue describes (the jump back to the top) the same opt-in way. One limit: if the Query Loop has blocks that don't support it, such as some third-party blocks, the editor turns full reload back on and shows a notice.
Closing as done. If you need the anchor version specifically, for example for links shared from page 2, please say so and we can reopen.
Partly automated with help from Claude.