Skip to content

Feature : Permalinks ordered by Date for Breadcrumbs#76571

Open
Vrishabhsk wants to merge 1 commit intoWordPress:trunkfrom
Vrishabhsk:add/date-breadcrumbs
Open

Feature : Permalinks ordered by Date for Breadcrumbs#76571
Vrishabhsk wants to merge 1 commit intoWordPress:trunkfrom
Vrishabhsk:add/date-breadcrumbs

Conversation

@Vrishabhsk
Copy link
Contributor

What?

Adds date-based permalinks support to the Breadcrumbs block. Now you can show breadcrumb trails like Home > 2026 > March > 12 > My Post Title to match date-based permalink structures.

Why?

If you use date-based permalinks on your site (like /2026/03/12/my-post/), your breadcrumbs should reflect that structure. Before this PR, the Breadcrumbs block only gave you two options:

  1. Hierarchy - Home > Parent Page > Child Page (for pages)
  2. Taxonomy - Home > Blog > Category > Post (for posts)

But a lot of sites use date-based permalinks, and there was no way to show Home > Year > Month > Day > Post Title in the breadcrumb trail. This PR adds that option.

How?

What changed

Block attribute

Added a new breadcrumbStyle dropdown with two options:

  • Default - Uses the existing behavior (hierarchy for pages, taxonomy for posts)
  • Date - Shows Year > Month > Day before the post title

The old prefersTaxonomy checkbox has been replaced with this dropdown. Existing blocks get migrated automatically.

PHP changes

Added a new block_core_breadcrumbs_get_date_breadcrumbs() function that builds the date trail from the post's publish date:

  • Year links to the year archive
  • Month links to the month archive (with localized month name)
  • Day links to the day archive

Editor changes

Replaced the "Prefer taxonomy terms" checkbox with a cleaner "Breadcrumb style" dropdown. Also fixed a bug where switching styles would briefly show stale content.

Testing Instructions

  1. Start the dev environment: npm run wp-env start
  2. Create a few posts with different publish dates
  3. Add a Breadcrumbs block to a post template (like single.html)
  4. In the sidebar, try the Breadcrumb style dropdown:
    • Default should show taxonomy or hierarchy depending on your post type
    • Date should show Year > Month > Day > Post Title
  5. On the frontend, click each date link and verify it goes to the right archive page

Preview

Screenshot 2026-03-17 at 2 06 00 PM Screenshot 2026-03-17 at 2 06 08 PM

@github-actions
Copy link

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

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: Vrishabhsk <vrishabhsk@git.wordpress.org>
Co-authored-by: ntsekouras <ntsekouras@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.

Breadcrumbs block: Add date-based permalinks

1 participant