Make WordPress Core

Opened 4 weeks ago

Last modified 11 days ago

#59270 new defect (bug)

Excerpts Not Showing Bold Text ...

Reported by: hmnvtn's profile hmnvtn Owned by:
Milestone: 6.3.2 Priority: normal
Severity: normal Version: 6.3
Component: Editor Keywords: needs-patch
Focuses: Cc:

Description

The text itself shows, but it does not show the bold attributes as it did up until 6.2.2.

Change History (6)

#1 @khokansardar
4 weeks ago

@hmnvtn yes, I have also checked, the issue is coming due to this line of code which actually filter excerpt based on excerpt length attributes applied in excerpt block.

<?php
$excerpt = wp_trim_words( $excerpt, $excerpt_length );

#2 @sabernhardt
4 weeks ago

  • Component changed from General to Editor
  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 6.3.2
  • Version set to 6.3

Thanks for the report!

The tag removal in the Post Excerpt blocks was already mentioned in a comment on the pull request GB44964. However, I did not find a follow-up issue (or pull request) on the Gutenberg repository to fix it. If you would like, you could create a new issue there.

This ticket was mentioned in Slack in #core-editor by bph. View the logs.


4 weeks ago

#5 @frzsombor
2 weeks ago

Coming from similar: #59348

It looks like the "block_type_metadata" filter gives us ability to modify original Gutenberg block settings, and this way it is possible to completely remove the "excerptLength" key from the metadata attributes array. This way we can bypass wp_trim_words() and only get the untrimmed excerpt with HTML content.

function fzs_filter_metadata_registration( $metadata ) {
    if ($metadata['name'] === 'core/post-excerpt') {
        unset($metadata['attributes']['excerptLength']);
    }
    return $metadata;
};
add_filter( 'block_type_metadata', 'fzs_filter_metadata_registration' );
Last edited 2 weeks ago by frzsombor (previous) (diff)

This ticket was mentioned in Slack in #core-editor by fabiankaegy. View the logs.


11 days ago

Note: See TracTickets for help on using tickets.