[wp-trac] [WordPress Trac] #59270: Excerpts Not Showing Bold Text ...

WordPress Trac noreply at wordpress.org
Thu Sep 14 15:04:03 UTC 2023


#59270: Excerpts Not Showing Bold Text ...
--------------------------+---------------------
 Reporter:  hmnvtn        |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  6.3.2
Component:  Editor        |     Version:  6.3
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+---------------------

Comment (by frzsombor):

 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 filter_metadata_registration( $metadata ) {
     if ($metadata['name'] === 'core/post-excerpt') {
         unset($metadata['attributes']['excerptLength']);
     }
     return $metadata;
 };
 add_filter( 'block_type_metadata', 'filter_metadata_registration' );
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59270#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list