0

Before Gutenberg blocks we used to add editor styles by using

add_editor_style( array( 'path/to/editor-style.css', 'whatever.css' ) );

Now we have Gutenberg editor whose stylesheet is also loaded by using the same function.

What if we want to keep stylesheet for both of them? I ask because there are plugins which allow users to disable Gutenberg. Obviously it's not possible to do something like:

 add_editor_style( array( 'editor-style-mce.css', 'editor-style-gutenberg.css' ) );

To make things more complicated for developers, there's an option to use classic editor as a Gutenberg block. It looks like we have to check for Gutenberg availability on after_setup_theme action and load proper editor stylesheet respectively but we can't do much when classic editor is used as Gutenberg block.

Is there anyone capable to provide any kind of solution?

0

You need to call add_theme_support( 'editor-styles' ) in the after_setup_theme hook.

More information

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.