[wp-trac] [WordPress Trac] #36778: Parent theme editor-style.css cannot be disabled

WordPress Trac noreply at wordpress.org
Tue Jun 14 23:05:11 UTC 2016


#36778: Parent theme editor-style.css cannot be disabled
-----------------------------+-----------------------------
 Reporter:  matthewmcvickar  |       Owner:
     Type:  enhancement      |      Status:  new
 Priority:  normal           |   Milestone:  Future Release
Component:  Editor           |     Version:
 Severity:  normal           |  Resolution:
 Keywords:  needs-patch      |     Focuses:  administration
-----------------------------+-----------------------------

Comment (by matthewmcvickar):

 Just tested it, and that doesn't work either.

 The parent theme isn't registering the stylesheet—there's just an
 {{{editor-style.css}}} there, and it's being picked up automatically (as
 described in
 [https://developer.wordpress.org/reference/functions/add_editor_style/
 add_editor_style()]).

 I did, however, just figure out a workaround using the
 [https://developer.wordpress.org/reference/hooks/mce_css/ mce_css] hook:

 {{{#!php
 <?php
 add_filter('mce_css', 'remove_parent_theme_editor_stylesheet');
 function remove_parent_theme_editor_stylesheet($stylesheets) {

   $stylesheets = explode(',', $stylesheets);

   foreach ($stylesheets as $key => $stylesheet) {
     if (strpos($stylesheet, get_template_directory_uri() . '/editor-
 style.css') !== false) {
       unset($stylesheets[$key]);
     }
   }

   $stylesheets = implode(',', $stylesheets);

   return $stylesheets;
 }
 }}}

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


More information about the wp-trac mailing list