Description
Introduced in #34334.
After the above change was merged (specific commit), themes that do not have a theme.json file or declare support for experimental-link-color will fail to load some plugin-based add_theme_support() calls. Calls from within the theme's functions.php file will still work as expected.
This applies specifically to custom-line-height, but may also be true for other options.
Step-by-step reproduction instructions
- Install and activate a theme that does not provide a theme.json file, nor declare support for
experimental-link-color. I recommend Twenty Twenty for this test.
- Create a new post with at least one paragraph block. Select that block and note that the
Line height option is not provided in the editor sidebar... this is expected, as the option is disabled by default.
- Install a plugin to add support for custom line height. The following bare-bones snippet should suffice as a basic plugin
.php file:
<?php
/**
* Plugin Name: Line Height Test
*/
function test_modify_theme_support() {
add_theme_support( 'custom-line-height' );
}
add_action( 'after_setup_theme', 'test_modify_theme_support', 11 );
(note the priority of 11. It ensures your plugin is firing after the theme's declarations, which will be important in a minute...)
- Activate your plugin and refresh the editor. Note that the
Line height option is still not provided.
Confirm your plugin is working:
- To confirm your plugin is working, add an image block. Note that option for
wide width and full width are included under alignment. This is expected, as support for these options is declared by the theme.
- Edit your plugin to also declare
remove_theme_support( 'align-wide' );
- Make sure you have the priority of your
add_action set to 11 as shown above
- Reload the editor and confirm that you can no longer apply
wide or full width alignments to image blocks.
You now have a plugin that can modify some theme_support parameters like align-wide but fails to modify specific ones like custom-line-height. Note this is theme specific, as described above, and only applies to themes that lack a theme.json file and do not declare support for experimental-link-color.
Expected outcome
Different options should be respected equally. In the above example, line height would activate alongside the removal of align-wide on TwentyTwenty.
Screenshots, screen recording, code snippet
No response
Environment info
WP 5.8.1, Gutenberg 11.5.0, with Twenty Twenty active.
2019 MacBook Pro, MacOS 11.5.2, Chrome 93.0.4577.63
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
Description
Introduced in #34334.
After the above change was merged (specific commit), themes that do not have a theme.json file or declare support for
experimental-link-colorwill fail to load some plugin-basedadd_theme_support()calls. Calls from within the theme'sfunctions.phpfile will still work as expected.This applies specifically to
custom-line-height, but may also be true for other options.Step-by-step reproduction instructions
experimental-link-color. I recommend Twenty Twenty for this test.Line heightoption is not provided in the editor sidebar... this is expected, as the option is disabled by default..phpfile:(note the priority of
11. It ensures your plugin is firing after the theme's declarations, which will be important in a minute...)Line heightoption is still not provided.Confirm your plugin is working:
wide widthandfull widthare included under alignment. This is expected, as support for these options is declared by the theme.remove_theme_support( 'align-wide' );add_actionset to11as shown abovewideorfull widthalignments to image blocks.You now have a plugin that can modify some
theme_supportparameters likealign-widebut fails to modify specific ones likecustom-line-height. Note this is theme specific, as described above, and only applies to themes that lack atheme.jsonfile and do not declare support forexperimental-link-color.Expected outcome
Different options should be respected equally. In the above example,
line heightwould activate alongside the removal ofalign-wideon TwentyTwenty.Screenshots, screen recording, code snippet
No response
Environment info
WP 5.8.1, Gutenberg 11.5.0, with Twenty Twenty active.
2019 MacBook Pro, MacOS 11.5.2, Chrome 93.0.4577.63
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes