[wp-trac] [WordPress Trac] #48569: Twenty Twenty: Theme-specific editor styles being improperly enqueued

WordPress Trac noreply at wordpress.org
Tue Nov 12 16:52:10 UTC 2019


#48569: Twenty Twenty: Theme-specific editor styles being improperly enqueued
----------------------------+-----------------------------
 Reporter:  markjaquith     |      Owner:  (none)
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  General         |    Version:  trunk
 Severity:  normal          |   Keywords:
  Focuses:  administration  |
----------------------------+-----------------------------
 Twenty Twenty's theme-specific block editor styles (i.e. things like
 fonts, centering, background color, etc) are being enqueued using
 `wp_enqueue_style()` instead of `add_editor_style()`, like they were in
 Twenty Nineteen. This means that it is impossible to distinguish between
 block-specific styles and theme-specific styles.

 When using Twenty Nineteen, for instance, a custom post type that does not
 display on the frontend and thus should not use the theme's styling, could
 do something like this (obviously you'd gate it with a post type check):

 {{{
 add_action( 'admin_init', function () {
     remove_editor_styles();
 });
 }}}

 But in Twenty Twenty, this has no effect, because the theme-matching
 editor styles are enqueued like any other style and get mixed in with core
 styles and block-specific styles.

 This is contrary to Gutenberg's guidelines for adding editor styles, which
 explicitly say to use `add_editor_style()`.

 https://github.com/WordPress/gutenberg/blob/master/docs/designers-
 developers/developers/themes/theme-support.md

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


More information about the wp-trac mailing list