Skip to content

Twenty Twenty-One: Skip the untitled title filter in the admin#12688

Open
itzmekhokan wants to merge 1 commit into
WordPress:trunkfrom
itzmekhokan:fix/65710-twentytwentyone-untitled-admin
Open

Twenty Twenty-One: Skip the untitled title filter in the admin#12688
itzmekhokan wants to merge 1 commit into
WordPress:trunkfrom
itzmekhokan:fix/65710-twentytwentyone-untitled-admin

Conversation

@itzmekhokan

Copy link
Copy Markdown

Twenty Twenty-One filters the_title to 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:

  • Since #65022, the post list table shows a trimmed excerpt in place of a missing title, gated on '' === get_the_title( $post ).
  • Twenty Twenty-One's filter fills empty titles with "Untitled", so that condition is never met in the admin. The excerpt fallback is suppressed and untitled posts display "Untitled" in the list table instead.

What the fix does:

  • Adds an is_admin() guard to twenty_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:

  • This matches the theme's existing idiom: the sibling callbacks twenty_twenty_one_continue_reading_link_excerpt() and twenty_twenty_one_continue_reading_link() already use the same in-function is_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.

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.
Copilot AI review requested due to automatic review settings July 25, 2026 03:20
@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.

Core Committers: Use this line as a base for the props when committing in SVN:

Props khokansardar.

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 to twenty_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.

@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The 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

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants