Created
October 8, 2022 01:57
-
-
Save iansvo/5f3a81762b9596f3ca0ca214d1fac49d to your computer and use it in GitHub Desktop.
Add frontend styles to the Gutenberg editor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* See: https://developer.wordpress.org/reference/functions/add_editor_style/ | |
* | |
*/ | |
add_action('admin_init', function() { | |
// Enable support for editor styles | |
add_theme_support('editor-style'); | |
add_editor_style('dist/css/your-css-file.css'); // Replace path to your frontend stylesheet | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As of this comment, if your stylesheet contains container queries, it will not be correctly added using this approach. I'm pretty sure this is a bug, see this stackoverflow post: https://wordpress.stackexchange.com/questions/415275/add-editor-style-not-working-after-upgrade-to-wp-v-6-2