Twenty Twenty-One: Skip the untitled title filter in the admin#12688
Twenty Twenty-One: Skip the untitled title filter in the admin#12688itzmekhokan wants to merge 1 commit into
Conversation
The theme filters `the_title` to display 'Untitled' for posts and pages that are missing a title. Since #65022, the post list table shows a trimmed excerpt in place of a missing title, but this filter fills the title with 'Untitled' and prevents that excerpt fallback from appearing in the admin. Only apply the filter on the front end, leaving admin titles untouched. Fixes #65710. See #65022.
|
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 Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Pull request overview
This PR adjusts Twenty Twenty-One’s the_title filter so that the theme’s “Untitled” replacement only applies on the front end, avoiding unintended admin UI changes (notably the post list table’s empty-title excerpt fallback introduced in core).
Changes:
- Add an
is_admin()guard totwenty_twenty_one_post_title()to return the original title in wp-admin. - Update the function docblock to note the front-end-only behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Twenty Twenty-One filters
the_titleto display "Untitled" for posts and pages that are missing a title. This is a front-end presentation concern, but the filter also runs in the admin.What the problem was:
'' === get_the_title( $post ).What the fix does:
is_admin()guard totwenty_twenty_one_post_title()so the "Untitled" replacement only applies on the front end. Admin titles are returned unchanged, restoring the excerpt fallback introduced in #65022.Approach and why:
twenty_twenty_one_continue_reading_link_excerpt()andtwenty_twenty_one_continue_reading_link()already use the same in-functionis_admin()check. It is the smallest change that resolves the ticket and does not alter front-end behaviour.Trac ticket: https://core.trac.wordpress.org/ticket/65710
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 4.8
Used for: Ticket analysis and writing PR desription. All changes were reviewed and validated by me.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.