I want to remove wp-reset-editor-styles because it inserts CSS properties like like revert, which goes against what I’m trying to accomplish (example below).
.editor-styles-wrapper p {
font-size: revert;
line-height: revert;
margin: revert;
}
Here’s what I’ve attempted.
function remove_editor_resets() {
wp_deregister_style('wp-reset-editor-styles');
}
add_action('admin_menu', 'remove_editor_resets');
It successfully removes the resets, but ends up breaking another style called wp-block-directory. Here’s what the relevant section of the load-styles.php URL looks like.
BEFORE: wp-block-directory
AFTER: wp-bloc&load%5Bchunk_1%5D=k-directory
I’ve attempted define( 'CONCATENATE_SCRIPTS', false );
but that does nothing.
I believe the issue has something to do with the way dependencies are setup in /wp-includes/script-loader.php.
2
Answers
You were close. Try
enqueue_block_editor_assets
instead ofadmin_menu
. Note that this will also remove some core styles needed by the editor.This seems to be a problem that a lot of people are having. Until WP releases an update around this, I think this is the best you can do (there may be additional styles needed):
Note: Tested on WP v5.8.3
I had the same problem. All the "revert" porperties simply broke up my CSS on gutenberg preview.
Here is the solution that I finally implemented on my website.
So now I have the following code :
Works perfectly on WP v5.9.3