Skip to content

Block: Query Pagination: Pagination inserted as a template part or pattern does not work #48296

@webmandesign

Description

@webmandesign

Description

I'm trying to separate each template into as many parts as possible for easier global design. Meaning, I want to have Query Pagination block as a template part, so user can easily change the design of the pagination in one place and it will affect all the instances where pagination template part is being used.

However, it seems it's not possible. When I insert pagination as a template part (or a pattern) into another template part with Query block, the pagination stops working. Pagination links are wrong and also the current paged state is not honored.

Is there any restriction for Query Pagination to be used directly as a child of Query block without being inserted as pattern or template part?

Step-by-step reproduction instructions

Creating a template part and a pattern with Query Pagination block. Here is the content:

<!-- wp:query-pagination {"paginationArrow":"arrow","align":"wide","layout":{"type":"flex","justifyContent":"center"}} -->
	<!-- wp:query-pagination-previous /-->
	<!-- wp:query-pagination-numbers /-->
	<!-- wp:query-pagination-next /-->
<!-- /wp:query-pagination -->

Then insert the pagination into some template file with a Query block using all of these:

<!-- wp:template-part {"slug":"pagination","theme":"theme-slug"} /-->

<!-- wp:pattern {"slug":"theme-slug/pagination"} /-->

<!-- wp:query-pagination {"paginationArrow":"arrow","align":"wide","layout":{"type":"flex","justifyContent":"center"}} -->
	<!-- wp:query-pagination-previous /-->
	<!-- wp:query-pagination-numbers /-->
	<!-- wp:query-pagination-next /-->
<!-- /wp:query-pagination -->

You will see, only the last approach works. Pagination inserted as a template part and a pattern does not work.

Screenshots, screen recording, code snippet

No response

Environment info

WordPress 6.1.1
both with and without Gutenberg 15.1.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] Query PaginationAffects the Query Pagination Block - used for pagination within the Query Loop Block[Status] DuplicateUsed to indicate that a current issue matches an existing one and can be closed[Type] EnhancementA suggestion for improvement.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions