Skip to content

Display excerpt or content snippet alongside "(no title)" fallback#79012

Open
sarthaknagoshe2002 wants to merge 3 commits into
WordPress:trunkfrom
sarthaknagoshe2002:fix/issue-78897
Open

Display excerpt or content snippet alongside "(no title)" fallback#79012
sarthaknagoshe2002 wants to merge 3 commits into
WordPress:trunkfrom
sarthaknagoshe2002:fix/issue-78897

Conversation

@sarthaknagoshe2002

@sarthaknagoshe2002 sarthaknagoshe2002 commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

What?

Closes #78897

This PR enhances the (no title) fallback across Gutenberg's interfaces (DataViews, Media Library, and Editor sidebars) by automatically appending a truncated snippet of the post's excerpt or content to help identify untitled posts.

Why?

Currently, posts or pages without a title display simply as (no title). When dealing with multiple untitled drafts, it becomes impossible for users to distinguish between them in DataViews lists, parent page comboboxes, or the media library. This PR solves the Gutenberg equivalent of WordPress Core Trac ticket #65022 by providing context to titleless entities.

How?

  1. Created centralized fallback utilities to parse excerpt or content. These safely strip HTML using (preventing accidental network requests) and apply smart truncation at the nearest word boundary up to 40 characters (e.g., (no title) - This is the start of my…).
  2. Updated the Page Attributes sidebar (parent.js) and DataViews Parent picker (parent-edit.tsx) to explicitly request excerpt,content in their REST API _fields queries so the fallback utilities have data to extract.
  3. Updated packages/media-fields/src/attached_to/view.tsx to leverage _embedded excerpt and content data so the right-hand sidebar correctly identifies untitled attached posts. (Note: The live search combobox still relies on the /wp/v2/search endpoint which strips excerpts, so that specific dropdown remains a known Core limitation until #65022 is merged).
  4. Updated the base field definitions (getValue inside index.ts) alongside the visual render components (view.tsx). This ensures the snippet is applied to the underlying data model, making untitled posts correctly searchable and alphabetically sortable within DataViews tables.

Testing Instructions

  1. Navigate to Pages > Add New (or Posts). Create a draft where the Title is completely empty, but write a sentence or two in the body content. Save the draft.
  2. Navigate to Appearance > Editor > Pages (or Posts). Verify the DataViews list now displays your draft as (no title) - [Your content snippet...].
  3. In that same list, click the 3-dots (Options) menu on your untitled draft and click Rename. Verify the input field is completely empty (it should not contain the snippet).
  4. Click Duplicate. Verify the input field only says (Copy) and does not contain the snippet.
  5. Click on "Quick Edit" & verify the title in the right sidebar.
  6. Open a normal, titled Page in the Editor. Open the Settings sidebar and navigate to Page Attributes. Click the Parent dropdown. Verify your untitled draft appears in the combobox list with its content snippet.
  7. (Requires DataViews Media Library Experiment): Go to the Site Editor Media section. In the right-hand details sidebar, click the Attached to field and search for your untitled draft. Once attached and saved, verify the display text in the sidebar shows the content snippet instead of falling back to the Post ID.

Screenshots or screencast

Quick edit sidebar DataViews
image image
Quick Edit Parent selector Parent selector
image image

@github-actions github-actions Bot added [Package] Editor /packages/editor [Package] Fields /packages/fields labels Jun 8, 2026
@sarthaknagoshe2002 sarthaknagoshe2002 marked this pull request as ready for review June 8, 2026 12:00
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

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: [Package] Editor, [Package] Fields.

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

github-actions Bot commented Jun 8, 2026

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.

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: sarthaknagoshe2002 <sarthaknagoshe2002@git.wordpress.org>
Co-authored-by: andrewserong <andrewserong@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] Editor /packages/editor [Package] Fields /packages/fields

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When a post title is empty, show post excerpt/content snippet as fallback alongside (no title)

1 participant