Skip to content

Breadcrumbs: Add taxonomy visibility option - #79218

Open
Pranjal1423 wants to merge 9 commits into
WordPress:trunkfrom
Pranjal1423:feature/breadcrumbs-taxonomy-toggle
Open

Pranjal1423 wants to merge 9 commits into
WordPress:trunkfrom
Pranjal1423:feature/breadcrumbs-taxonomy-toggle

Conversation

@Pranjal1423

Copy link
Copy Markdown
Contributor

What?

Closes #79209

Adds a new "Show taxonomy breadcrumb" setting to the Breadcrumbs block. When enabled (default), taxonomy breadcrumbs are displayed. When disabled, taxonomy breadcrumbs are omitted from the breadcrumb trail.

Why?

Currently, taxonomy breadcrumbs are always displayed in the Breadcrumbs block. While it is possible to modify this behavior using filters, doing so requires custom code.

This change provides a UI setting similar to the existing "Show home breadcrumb" and "Show current breadcrumb" options, allowing users to control taxonomy visibility directly from the editor.

How?

  • Added a new showTaxonomy block attribute with a default value of true.
  • Added a toggle control in the Breadcrumbs block settings panel.
  • Updated the breadcrumb rendering logic to skip taxonomy breadcrumbs when the setting is disabled.
  • Added PHPUnit tests covering the new behavior.

Testing Instructions

  1. Start the local WordPress environment with npm run wp-env start.
  2. Create or edit a post and assign a category.
  3. Insert a Breadcrumbs block.
  4. Select the Breadcrumbs block and open the block settings sidebar.
  5. Verify a new Show taxonomy breadcrumb toggle is available.
  6. Verify taxonomy breadcrumbs are displayed when the toggle is enabled.
  7. Disable the toggle and verify taxonomy breadcrumbs are hidden.
  8. Save the post and reload the editor.
  9. Verify the setting persists after reload.
  10. View the post on the frontend and verify the breadcrumb output matches the selected setting.

Testing Instructions for Keyboard

  1. Open a post containing a Breadcrumbs block.
  2. Use Tab to navigate to the Breadcrumbs block.
  3. Use keyboard navigation to open the block settings sidebar if necessary.
  4. Navigate to the Show taxonomy breadcrumb toggle using Tab.
  5. Toggle the setting using Space or Enter.
  6. Verify taxonomy breadcrumbs are shown or hidden accordingly.
  7. Confirm all functionality is accessible without using a mouse.

Screenshots or screencast

N/A

Use of AI Tools

ChatGPT was used to assist with understanding the issue, exploring implementation approaches, and reviewing the proposed changes. All code, testing, and final submission details were reviewed and verified before submission.

@github-actions

Copy link
Copy Markdown

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: .

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

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: Pranjal1423 <pranjal4804@git.wordpress.org>
Co-authored-by: nendeb <nendeb55@git.wordpress.org>

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

@github-actions github-actions Bot added [Package] Block library /packages/block-library First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository labels Jun 16, 2026
@github-actions

Copy link
Copy Markdown

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @Pranjal1423! In case you missed it, we'd love to have you join us in our Slack community.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

This branch has not been deployed

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

Labels

First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Package] Block library /packages/block-library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

I want to control whether taxonomies are displayed or hidden in the Breadcrumbs block.

1 participant