Skip to content

Conversation

sunyatasattva
Copy link
Contributor

@sunyatasattva sunyatasattva commented Sep 5, 2025

What?

The term-description block, as opposed to the post-title or the query-title, always showed a placeholder, even when the data was technically available (e.g. if the user was modifying a specific category template).

This PR fixes that by allowing the term-description block to either receive context from a parent (like the post-title), or fallback to the parsing of the template slug (like the query-title).

Why?

Not showing the actual content is not only a degraded user experience (as the user can't preview the template correctly without displaying the actual description), but also inconsistent with the behavior of other blocks.

How?

The PR basically implements already available patterns from post-title and query-title. This allows the block to be quite versatile and reusable in different contexts.

Testing Instructions

Preserving original functionality

  1. Open the All Archives template.
  2. Insert the term-description block.
  3. Verify that it displays a placeholder.

New functionality

  1. Create a new template for a specific Category (with a description).
  2. Insert the term-description block.
  3. Verify that the actual description is shown, and not a placeholder.

- Added `usesContext` to `block.json` for `termId` and `taxonomy`.
- Implemented `useTermDescription` hook to fetch term descriptions based on
context or fallback to template parsing.
- Updated `TermDescriptionEdit` component to display term descriptions or a
placeholder based on the fetched data.

This improves the block's functionality by allowing it to dynamically retrieve and
display term descriptions in various contexts.
Copy link

github-actions bot commented Sep 5, 2025

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.

  • Type-related labels to choose from: [Type] Automated Testing, [Type] Breaking Change, [Type] Bug, [Type] Build Tooling, [Type] Code Quality, [Type] Copy, [Type] Developer Documentation, [Type] Enhancement, [Type] Experimental, [Type] Feature, [Type] New API, [Type] Task, [Type] Technical Prototype, [Type] Performance, [Type] Project Management, [Type] Regression, [Type] Security, [Type] WP Core Ticket, Backport from WordPress Core, Gutenberg Plugin, New Block.
  • Labels found: .

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.

Copy link

github-actions bot commented Sep 5, 2025

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: sunyatasattva <[email protected]>

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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant