[wp-trac] [WordPress Trac] #59704: Twenty Fifteen: harden twentyfifteen_fonts_url code for php 8.1

WordPress Trac noreply at wordpress.org
Mon Jan 29 08:26:35 UTC 2024


#59704: Twenty Fifteen: harden twentyfifteen_fonts_url code for php 8.1
---------------------------+------------------------------
 Reporter:  jordesign      |       Owner:  (none)
     Type:  enhancement    |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Bundled Theme  |     Version:
 Severity:  normal         |  Resolution:
 Keywords:                 |     Focuses:
---------------------------+------------------------------

Comment (by sabernhardt):

 A change similar to the patch on #45880 could avoid the error when the
 font stylesheet function does not return a string as expected, and it
 should be better with empty strings too.

 {{{
                 $editor_styles = array( 'css/editor-style.css',
 'genericons/genericons.css' );
                 $fonts_url     = twentyfifteen_fonts_url();
                 if ( $fonts_url ) {
                         $editor_styles[] = str_replace(
                                 array( get_template_directory_uri() . '/',
 get_stylesheet_directory_uri() . '/' ),
                                 '',
                                 $fonts_url
                         );
                 }
                 add_editor_style( $editor_styles );
 }}}

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


More information about the wp-trac mailing list