Make WordPress Core

Opened 4 months ago

Last modified 4 months ago

#62417 new defect (bug)

Excerpts don't include content from list-item blocks.

Reported by: dougwollison's profile dougwollison Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: trunk
Component: Formatting Keywords: has-patch has-screenshots has-testing-info
Focuses: Cc:

Description

Currently, excerpt_remove_blocks() allows the list block, but not the newer (since 6.0) list-item block. This results in all content contained in lists from being excluded from the excerpt.

Attachments (1)

62417-0.diff (357 bytes) - added by dougwollison 4 months ago.
Adds core/list-item to $allowed_inner_blocks

Download all attachments as: .zip

Change History (3)

@dougwollison
4 months ago

Adds core/list-item to $allowed_inner_blocks

#1 @abcd95
4 months ago

  • Keywords has-screenshots has-testing-info added

I've successfully reproduced the issue and tested the patch. Here's my verification:

Steps to Reproduce Used:

  1. Created a test post with this structure:
    • Paragraph block with text "Before the list"
    • List block with items:
      • First item in list
      • Second item in list
      • Third item with some detailed text
    • Paragraph block with text "After the list"
  1. Before Patch:
    • Checked excerpt in post listing
    • Only paragraph content appeared ("Before the list. After the list.")
    • All list content was missing from excerpt
  1. After Applying Patch:
    • Added 'core/list-item' to $allowed_inner_blocks
    • Checked excerpt again
    • Full content appears correctly including list items

This confirms that:

  1. The issue is resolved by including core/list-item block
  2. Excerpts now maintain proper content flow
  3. No regression in other block content handling

Before applying the patch - https://postimg.cc/n9K6vTYn
After applying the patch - https://postimg.cc/H8xTsq1f

✅ The patch successfully fixes the excerpt generation for list content while maintaining expected excerpt behavior for other blocks. 👍

This ticket was mentioned in PR #7807 on WordPress/wordpress-develop by @geekofshire.


4 months ago
#2

This PR resolves an issue where content within list-item blocks was excluded from post excerpts. The function excerpt_remove_blocks() now allows core/list-item as part of $allowed_inner_blocks, ensuring that list content is correctly included in generated excerpts.

Trac ticket: https://core.trac.wordpress.org/ticket/62417

Note: See TracTickets for help on using tickets.