Pablo
Pablo

Reputation: 21

WordPress 5.9 editor-style.css not working anymore and adds css properties that overrides block styling

I have a WP site with the Gutenberg editor styled (the place where you are writing the entry). It worked perfectly until this 5.9 update, where there have been added styles like these ones:

html :where(.editor-styles-wrapper) h1,
html :where(.editor-styles-wrapper) h2,
html :where(.editor-styles-wrapper) h3,
html :where(.editor-styles-wrapper) h4,
html :where(.editor-styles-wrapper) h5,
html :where(.editor-styles-wrapper) h6,
html :where(.editor-styles-wrapper) select {
    font-size: revert;
    margin: revert;
    color: revert;
    line-height: revert;
    font-weight: revert
}

Is there any way to dequeue those styles? I don't want to dequeue all the editor-styles and calling 1 by 1 each needed style, I need a more scalable solution (because I would have to check if they added new css in every update).

I've noticed that this is not working anymore, maybe it's related:

add_theme_support('editor-styles');
add_editor_style( 'editor-style.css' ); 

Upvotes: 2

Views: 2511

Answers (1)

S.Walsh
S.Walsh

Reputation: 3699

In WordPress 5.9, many changes were introduced to how styling/theming is done including theme.json and block themes as part of Full Site Editing. Rather than trying to remove or dequeue the base Editor style defaults, I would try adapting what you have in your themes editor-style.css to support blocks and move towards theme.json gradually where you can.

For reference, the where:(.editor-styles-wrapper) is defined in the Block Library reset.scss and its stated that those rules are only needed when the block editor is not being loaded in an iframe.

Also, add_theme_support('editor-styles') and add_editor_style('editor-style.css' ) are still supported, its likely that your style being overriden by the Editors CSS reset.

Upvotes: 3

Related Questions