Skip to content

Feat: Add “Show related posts” toggle & "same term" filter/flag to display related posts.#77125

Open
sarthaknagoshe2002 wants to merge 2 commits intoWordPress:trunkfrom
sarthaknagoshe2002:fix/issue-77099
Open

Feat: Add “Show related posts” toggle & "same term" filter/flag to display related posts.#77125
sarthaknagoshe2002 wants to merge 2 commits intoWordPress:trunkfrom
sarthaknagoshe2002:fix/issue-77099

Conversation

@sarthaknagoshe2002
Copy link
Copy Markdown
Contributor

What?

Closes #77099

Adds a “Show related posts” toggle to display posts sharing the same categories/tags as the current post.

Why?

This is a longstanding gap for theme authors. The most common use case is a “Related Posts” section at the bottom of a single post. Today, the Query Loop block requires selecting explicit terms and has no awareness of the current post’s terms.

How?

Added a toggle labeled “Show related posts” for same-term filtering.
Uses core-data to fetch the current post’s categories/tags dynamically.
Automatically update the block query when terms change.

Testing Instructions

  1. Edit a post with multiple categories and tags.
  2. Insert the Query loop block.
  3. Toggle “Show related posts” on, the block should list posts with the same categories/tags.
  4. Toggle “Show related posts” off, manual include/exclude lists should apply instead.
  5. Save the post, confirm the block list remains correct in the editor and on the frontend.

The Theme authors can use __experimentalSameTerm flag to enable this feature.

Screenshots or screencast

image

@github-actions github-actions bot added the [Package] Block library /packages/block-library label Apr 8, 2026
@sarthaknagoshe2002 sarthaknagoshe2002 marked this pull request as ready for review April 8, 2026 10:50
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Required label: Any label starting with [Type].
  • Labels found: [Package] Block library.

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: sarthaknagoshe2002 <sarthaknagoshe2002@git.wordpress.org>
Co-authored-by: henriqueiamarino <iamarinoh@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

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

Labels

[Package] Block library /packages/block-library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Query Loop: add "In same term" filter to display related posts by taxonomy

1 participant