[wp-trac] [WordPress Trac] #59896: Block editor default styles not loaded when stylesheet with the same name as the theme is registered

WordPress Trac noreply at wordpress.org
Mon Nov 13 16:59:09 UTC 2023


#59896: Block editor default styles not loaded when stylesheet with the same name
as the theme is registered
--------------------------+-----------------------------
 Reporter:  kingkool68    |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Editor        |    Version:  6.4
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 I've got a custom theme that lives in a directory called "coderpad".
 Inside the theme I load a custom stylesheet with the handle "coderpad"
 which is registered via the "init" hook and enqueued via the
 "wp_enqueue_scripts" hook. I don't load any sort of custom editor styles
 as part of this theme.

 After upgrading to WordPress 6.4 the block editor fails to load any
 default styles. The content in the editor looks like a big wall of text
 without any formatting. My simple workaround is to only register the
 stylesheet when it's not an admin request:


 {{{
 if ( ! is_admin() ) {
     wp_register_style(
         'coderpad',
         get_template_directory_uri() . '/assets/css/coderpad.min.css',
         array(),
         null,
         'all'
     );
 }
 }}}

 This issue also appears to not happen if I rename the stylesheet handle to
 something like "coderpad-foo"

 Here are two screenshots of what is happening: https://imgur.com/a/kgKkrmw

 I'm not sure if there is logic somewhere that detects if a stylesheet with
 the same handle as the theme directory is registered then don't load
 default styles but thought I would post about this unexpected behavior.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59896>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list