Skip to content

Update Terms Query block to inherit from post context#72306

Draft
cr0ybot wants to merge 10 commits into
WordPress:trunkfrom
cr0ybot:update/terms-query-post-inherit
Draft

Update Terms Query block to inherit from post context#72306
cr0ybot wants to merge 10 commits into
WordPress:trunkfrom
cr0ybot:update/terms-query-post-inherit

Conversation

@cr0ybot
Copy link
Copy Markdown
Contributor

@cr0ybot cr0ybot commented Oct 14, 2025

What?

Related to #71911

We currently support inheriting the parent term from a taxonomy archive context, but there is no mechanism in place for inheriting from a post.

Why?

We have blocks that display a post's terms as comma-separated lists or button-like links (but not actually buttons), but the in-editor layout and design tools are very limited and users must rely on block styles provided by the theme.

If we still had term data block bindings and full layout controls in place, this would enable a wide variety of customizations for how terms are displayed in single post templates.

How?

This PR extends the meaning of inherit = true to inherit the terms of a post in context by checking if postId is set or if editing a single template.

Testing Instructions

You must enable "Experimental blocks" in the Gutenberg plugin settings!

Post inheritance from a single post:

  1. Create or edit a post and add the Terms Query block
  2. Ensure the post has terms applied and select the same taxonomy for the Terms Query block
  3. Set the "inherit terms from post" setting to true
  4. Confirm that the terms displayed are the same as the ones selected for the post both in the editor and on the front end

Post inheritance within a Query Loop:

  1. Create or edit a page and add a Query Loop, setting the query type to "custom"
  2. Ensure that the post type selected is the same as the test posts with terms applied
  3. Add a Terms Query block into the Post Template, select the taxonomy you're testing, and set "inherit terms from post" to true
  4. Confirm that the terms displayed are the same as the ones selected for the post both in the editor and on the front end

Post inheritance in a single template:

  1. Create or edit the single template in the Site Editor and add the Terms Query block
  2. Select the taxonomy you're testing, and set "inherit terms from post" to true
  3. Since there is no post to get terms from in the editor, the default set of terms will be displayed
  4. Confirm that the terms displayed for a post on the front end are the same as the ones selected for the post

Screenshots or screencast

To do

Issues

Inheritance from the current post works, but the post must have been previously saved with the terms for them to show up—they do not dynamically change when updating the terms on the post.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant