Repository navigation
Description
Description
When the posts page has HTML in its title, such as News <em>Updates</em>, the Breadcrumbs block shows that title with the tags as plain text. Other post titles in the trail render their HTML.
This affects the breadcrumb for the posts page in two places:
- Single posts: Home /
News <em>Updates</em>/ Uncategorized / Post One - The posts page itself: Home /
News <em>Updates</em>
The same title renders correctly when the posts page appears as a parent page. A child page of it shows Home / News Updates / Child of News.
Expected: the posts page title renders its HTML like the other post titles: Home / News Updates / Uncategorized / Post One.
Cause: each item is escaped with esc_html() unless it sets allow_html, in which case it goes through wp_kses_post() instead (breadcrumbs/index.php). The current post and parent page items set allow_html (L143-L154, L311-L315), but the two items that use the posts page title don't (L47 and L124). Setting allow_html on both would fix it.
Step-by-step reproduction instructions
- Create a page titled
News <em>Updates</em>and publish it. - Create a post titled
Post <em>One</em>and publish it. - In Settings → Reading, choose A static page, set any page as the homepage and "News Updates" as the posts page, and save.
- With Twenty Twenty-Five, add a Breadcrumbs block to the Single Posts and Blog Home templates.
- View "Post One". The posts page crumb shows the tags as text, while "One" is italic.
- View the posts page. Its crumb shows the tags as text too.
To compare, add a Breadcrumbs block to the Pages template, then create a page with "News Updates" as its parent and view it. There, "Updates" is italic.
Screenshots, screen recording, code snippet
Posts Page (same page but does not render correctly)
Parent page renders correctly.
Environment info
- WordPress latest.
- Gutenberg trunk.
Please confirm that you have searched existing issues in the repo.
- Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
- Yes
Please confirm which theme type you used for testing.
- Block
- Classic
- Hybrid (e.g. classic with theme.json)
- Not sure
Activity