Skip to content

Commit 54106f6

Browse files
committed
Themes: Clarify 'editor-style' vs 'editor-styles' documentation.
WordPress themes can support both `editor-styles` (plural) for the block editor and `editor-style` (singular) for the TinyMCE/classic editors. This improves the documentation of the `add_editor_style()` and `remove_editor_styles()` functions to use `add_theme_support( 'editor-styles' )` and `remove_theme_support( 'editor-styles' )` to add stylesheets to the block editor. The tests for theme support are expanded to ensure that the subtle distinction is retained. Props azaozz, chaion07, desrosj, hellofromtonya, khoipro, oglekler, sabernhardt, sergeybiryukov, soean, sukhendu2002. Fixes #60826. Built from https://develop.svn.wordpress.org/trunk@64693 git-svn-id: http://core.svn.wordpress.org/trunk@63843 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 parent 440d23a commit 54106f6

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

‎wp-includes/theme.php‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2183,6 +2183,14 @@ function wp_update_custom_css_post( $css, $args = array() ) {
21832183
* Since version 3.4 the TinyMCE body has .rtl CSS class.
21842184
* It is a better option to use that class and add any RTL styles to the main stylesheet.
21852185
*
2186+
* Internally this registers the 'editor-style' (singular) theme support to enable
2187+
* editor stylesheets for the classic/TinyMCE editor.
2188+
*
2189+
* The plural form, 'editor-styles', is a separate theme support that allows the block
2190+
* editor to load the stylesheets registered by this function. To add styles to the
2191+
* block editor, use add_theme_support( 'editor-styles' ) in addition to this function.
2192+
* Block themes support 'editor-styles' by default.
2193+
*
21862194
* @since 3.0.0
21872195
*
21882196
* @global array $editor_styles
@@ -2209,6 +2217,13 @@ function add_editor_style( $stylesheet = 'editor-style.css' ) {
22092217
/**
22102218
* Removes all visual editor stylesheets.
22112219
*
2220+
* Internally this removes the 'editor-style' (singular) theme support added by
2221+
* add_editor_style(). In the admin, it also clears the registered stylesheets,
2222+
* so they are no longer loaded in either the classic/TinyMCE or the block editor.
2223+
*
2224+
* The plural form, 'editor-styles', is a separate theme support and is not affected
2225+
* by this function. To remove it, use remove_theme_support( 'editor-styles' ).
2226+
*
22122227
* @since 3.1.0
22132228
*
22142229
* @global array $editor_styles
@@ -3074,7 +3089,11 @@ function get_theme_support( $feature, ...$args ) {
30743089
* @return bool Whether feature was removed.
30753090
*/
30763091
function remove_theme_support( $feature ) {
3077-
// Do not remove internal registrations that are not used directly by themes.
3092+
/*
3093+
* Do not remove internal registrations that are not used directly by themes.
3094+
* 'editor-style' (singular) is added by add_editor_style(); use remove_editor_styles().
3095+
* It is unrelated to the 'editor-styles' (plural) feature, which can be removed here.
3096+
*/
30783097
if ( in_array( $feature, array( 'editor-style', 'widgets', 'menus' ), true ) ) {
30793098
return false;
30803099
}

‎wp-includes/version.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* @global string $wp_version
1818
*/
19-
$wp_version = '7.2-beta1-64692';
19+
$wp_version = '7.2-beta1-64693';
2020

2121
/**
2222
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

0 commit comments

Comments
 (0)