Make WordPress Core

Opened 4 months ago

Last modified 5 weeks ago

#60826 new defect (bug)

Fix incorrect use of add_theme_support( 'editor-style(s)' )

Reported by: soean's profile Soean Owned by:
Milestone: 6.7 Priority: normal
Severity: normal Version:
Component: Themes Keywords: has-patch reporter-feedback dev-feedback
Focuses: Cc:

Description

In the functions add_editor_style(), remove_editor_styles() and remove_theme_support() the Theme $feature parametereditor-style is used instead of editor-styles.

It should be: add_theme_support( 'editor-styles' );

See docs: https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-support/#editor-styles
See code docs: https://github.com/WordPress/wordpress-develop/blob/8d0aed455b1790c5d51386f7675d9e8d68e48edf/src/wp-includes/theme.php#L2672

Change History (10)

This ticket was mentioned in PR #6308 on WordPress/wordpress-develop by @Soean.


4 months ago
#1

  • Keywords has-patch added

@audrasjb commented on PR #6308:


4 months ago
#2

This will require a Unit test update, too.

@Soean commented on PR #6308:


4 months ago
#4

@audrasjb I updated the tests and added a new test for editor styles.

#5 @sabernhardt
4 months ago

Related/duplicate: #51755

#6 @SergeyBiryukov
3 months ago

  • Milestone changed from Awaiting Review to 6.6

#7 @oglekler
7 weeks ago

I wonder if this can possibly break something for people who used 'editor-style' because it is used in the core? 🤔

add_editor_style() function declaring support for 'editor-style' and I found this confusing, so I added "add_theme_support( 'editor-styles' )" before add_editor_style() in theme I am working on (classic approach works for me better).

I also wonder if test should count on different state for classic and block themes, because for block themes, 'editor-styles' declared by default.

I think, the patch needs rebase.

This ticket was mentioned in Slack in #core by oglekler. View the logs.


5 weeks ago

#9 @hellofromTonya
5 weeks ago

  • Keywords reporter-feedback dev-feedback added

Is the block editor using these functions?

These functions are intended and are documented for the TinyMCE (see [13441] and [16721]).

For example, add_editor_style() is documented as:

Adds callback for custom TinyMCE editor stylesheets.

I'm curious what the impact might be of changing these instances and if any shims might be needed for older and non-block themes using them.

#10 @oglekler
5 weeks ago

  • Milestone changed from 6.6 to 6.7

Because we need further investigation and clearly a way forward, I am moving this to the next milestone.

Note: See TracTickets for help on using tickets.