Skip to content

Duplicating Query Block can result in duplicate Query IDs #55823

Open

Description

@peterwilsoncc

Description

Duplicating the Query Block can result in duplicate query IDs resulting in unexpected enhanced pagination behaviour.

Step-by-step reproduction instructions

  1. Install WP Trunk ( WordPress/wordpress-develop@64bfb23 )
  2. Do not enabled Gutenberg
  3. Generate some posts via wp cli, wp post generate
  4. Go to the site editor
  5. Edit the home page
  6. Remove all group blocks except for the group containing Query block (this is to make it easier to see the effect while testing)
  7. Select the query block
  8. Ensure "Force page reload" is turned off
  9. Add a pagination block if required
  10. Select the group block above the query block (ie, the group containing the heading "Watch, Read, Listen")
  11. Duplicate the group
  12. In the duplicated group, modify the query so it doesn't inherit from the main query
  13. Save the template
  14. Visit the front end of the site
  15. Click next page on either query block
  16. Observe the page changes on both blocks

Screenshots, screen recording, code snippet

No response

Environment info

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

Activity

  1. Mamaduka commented on Nov 3, 2023

    @Mamaduka
    Member

    This is a known issue with internal attributes - #29693. Here're two ongoing explorations: #34750 and #38643.

  2. gziolo commented on Nov 6, 2023

    @gziolo
    Member

    This is a known issue with internal attributes - #29693. Here're two ongoing explorations: #34750 and #38643.

    There is a detailed overview of the current limitations of block attributes provided by @noisysocks in #49466. There are multiple ways we could address it, but all the options should have working prototypes so we would need to finally make a decision what is the best way path forward and incorporate them with the Query block to fix the issue.

  3. ryanwelcher commented on Feb 20, 2024

    @ryanwelcher
    Contributor

    Wanted to bump this as I just received a report on my Advanced Query Loop plugin for this - ryanwelcher/advanced-query-loop#42

  4. archiveofwork commented on Apr 21, 2024

    @archiveofwork

    I was about to post about this same issue

  5. skorasaurus commented on Jun 13, 2024

    @skorasaurus
    Member

    This still occurs however I've worked around this by manually changing the queryid of one of the loops in the code editor.

  6. albanyacademy commented on Jun 18, 2024

    @albanyacademy

    Wanted to bump this as I just received a report on my Advanced Query Loop plugin for this - ryanwelcher/advanced-query-loop#42

    for our plugin we just expose the query id:
    image

  7. roborourke commented on Feb 18, 2026

    @roborourke
    Contributor

    I've worked around this for now in our query loop extensions plugin here using a HOC:

    https://github.com/humanmade/hm-query-loop/blob/main/src/index.js#L58-L105

    Also has a backup approach to capture any dupes server side too:

    https://github.com/humanmade/hm-query-loop/blob/main/hm-query-loop.php#L181-L267

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Block] Query LoopAffects the Query Loop Block[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