Skip to content

Post Formats: Query loop shows the wrong posts when inheriting the query from the post format archive template #65320

@carolinan

Description

@carolinan

Description

I have only tested this with a block theme.

When a query loop block with the setting Inherit query from template is placed in an archive template for a post format,
the correct posts are shown on the front, but not in the editor. In the editor, all posts are shown.

Step-by-step reproduction instructions

First, you need a block theme, and you need to enable post format support on the active theme.
If your theme does not have a functions.php file, create one.

Example:

function twentytwentyfour_setup(){
	add_theme_support( 'post-formats', array( 'standard', 'aside', 'gallery', 'audio', 'video', 'link', 'image', 'chat', 'status', 'quote' ) );
}

add_action( 'after_setup_theme', 'twentytwentyfour_setup' );

Set the permalinks on the test installation to Post name.

Create a few posts and assign them the link post format.

Next, add a link post format archive template inside the theme's templates folder.
templates/taxonomy-post_format-post-format-link.html

Go to Appearance > Editor > Templates, locate and edit the template.
Add a query loop block. In the block settings sidebar, make sure that Inherit query from template is enabled.
Check if the query loop shows the correct posts, it should only show the posts that you assigned the link format to.
Save.

View the archive on the front: Add type/link/ after your test domain in the browser address bar.
(For example http://66.local/type/link/ )

Screenshots, screen recording, code snippet

No response

Environment info

WordPress 6.6.2, with and without Gutenberg trunk.

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

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