Fix breadcrumb date archive links, comma category names, and author warning - #111
Merged
Merged
Conversation
…s, PHP warning on bad author URLs
All three confirmed live, not just from source:
1. Date archive month link pointed at /YYYY/00/, a dead URL that still
200s. get_month_link() takes a numeric month, but the code passed
get_the_time('M') (the month name, e.g. "Sep") instead of get_the_time('m').
Also added the missing space between the day suffix and month name
("15thMar" -> "15th Mar"), and stopped passing date-format codes ('Y',
'M', 'm', 'jS') through __() - they're PHP date() format characters,
not translatable text, and only ever collided with the month-link bug
because nobody noticed the untranslated fallback still worked.
2. A category name containing a comma (a perfectly normal name, e.g.
"Food, Drink") broke the breadcrumb markup. The code built one
comma-joined string via get_category_parents(..., ',') then split it
back apart with explode(',', ...), so the comma in the name itself got
mistaken for the separator - opening an <a> in one <li> and closing it
in the next. Rebuilt from actual term objects via
get_ancestors()/get_term(), which can't confuse a name for a separator.
3. A non-existent author archive URL (which WordPress core still answers
with HTTP 200) logged "PHP Warning: Attempt to read property
'display_name' on false" on every anonymous visit, since get_userdata()
was used unchecked. Added the missing existence check.
Same code, same bugs, in both Free and Pro's inc/extras.php.
QA suite — refused, no regression specThis PR changes product source but adds no spec, so the suite was Source files changed with no matching spec |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
Only a minor issue-reference documentation nit remains; no code-blocking issues were identified.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Fixes breadcrumb date links, comma-containing category names, and warnings for nonexistent author archives.
Changes:
- Corrects month archive URLs and date formatting.
- Builds category breadcrumbs from term objects.
- Guards missing author data.
| File | Summary |
|---|---|
inc/extras.php |
Updates breadcrumb generation and author handling. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+221
to
+223
| // Get parent categories and the category itself, top-most ancestor first. | ||
| $cat_ancestors = array_reverse( get_ancestors( $last_category->term_id, 'category' ) ); | ||
| $cat_ancestors[] = $last_category->term_id; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes #93
Changes proposed in this Pull Request:
Three bugs in flash_breadcrumbs() (inc/extras.php), all verified live, not just from source:
Date archive month link pointed at /YYYY/00/, a dead URL that still returns 200. get_month_link() takes a numeric month, but the code passed get_the_time('M') (the month name, e.g. "Sep") instead of get_the_time('m'). Also added the missing space between the day suffix and month name ("15thMar" -> "15th Mar"), and stopped passing date-format codes ('Y', 'M', 'm', 'jS') through __() - they're PHP date() format characters, not translatable text.
A category name containing a comma (a perfectly normal name, e.g. "Food, Drink") broke the breadcrumb markup. The code built one comma-joined string via get_category_parents(..., ',') then split it back apart with explode(',', ...), so the comma in the name itself got mistaken for the separator - opening an in one
A non-existent author archive URL (which WordPress core still answers with HTTP 200) logged "PHP Warning: Attempt to read property 'display_name' on false" on every anonymous visit, since get_userdata() was used with no existence check. Added the missing check.
Verified all three live: reproduced the broken /2026/00/ link and "15thMar"-style concatenation on a day archive, reproduced the exact broken markup on a post in a category named "Food, Drink", and reproduced the exact PHP warning on /author// - then confirmed all three are gone after the fix, with no regression on ordinary categories/archives/authors.
How to test the changes in this Pull Request:
Types of changes:
Other information:
Changelog entry
Fix - Breadcrumb date archive links, category names containing a comma, and a PHP warning on non-existent author URLs.