Opened 4 weeks ago
Last modified 4 weeks ago
#65835 new enhancement
Excerpts: Extract content from Playlist block tracks
| Reported by: | huzaifaalmesbah | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Editor | Version: | 7.1 |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
The Playlist block contains meaningful content for each track, including Title, Artist, and Album. However, when WordPress automatically generates an excerpt, this content does not appear to be considered.
For example, a Playlist track can contain:
Artist: Unknown artist Album: Unknown album Title: sample-3s
The Title, Artist, and Album fields provide meaningful textual content that could be used when generating an automatic excerpt.
Steps to reproduce
- Create a new post.
- Add a Playlist block.
- Add an audio track.
- Set the track Title, Artist, and Album.
- Publish the post without adding a manual excerpt.
- Retrieve the post through the REST API:
/wp-json/wp/v2/posts/<post-id>
- Check the
excerpt.renderedvalue.
Actual result
The Playlist track content is not included in the automatically generated excerpt.
For example:
"excerpt": {
"rendered": "",
"protected": false
}
Expected result
The automatically generated excerpt should include meaningful textual content from the Playlist tracks.
For example:
sample-3s
Or, when the metadata is available:
sample-3s — Artist Name — Album Name
Proposed solution
Consider extracting the available Title, Artist, and Album metadata from Playlist tracks when generating automatic excerpts.
The Title could be prioritized, while Artist and Album could be included when available. Default values such as Unknown artist and Unknown album could be ignored.
This would be similar to how WordPress considers meaningful nested content from other blocks when generating automatic excerpts.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Thanks for the detailed report!
I looked into how
excerpt_remove_blocks()works. It uses an allowlist of blocks that can contribute rendered HTML to auto-excerpts.core/playlistandcore/playlist-trackaren't included, so their content gets skipped. Since the useful text (title,artist, andalbum) lives in block attributes rather than inner text blocks, it never makes it into the excerpt.I see two possible approaches:
We can maybe either add
core/playlisttoexcerpt_allowed_wrapper_blocks, this would allow the playlist to be rendered normally for the excerpt, OR handle playlists explicitly. We could add a dedicated excerpt handler forcore/playlistand extract the track attributes directly. We can include the track title and optionally the artist/album when they have meaningful values, while skipping defaults like "Unknown artist" and "Unknown album".I prefer Option 2. It's more explicit, avoids depending on the block's rendered HTML, and gives us better control over what appears in excerpts. It also matches how the playlist block already builds its accessible labels.
Important to note that this should also have visibility in Gutenberg Ecosystem