mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 12:50:28 +00:00
Widgets: Add support for the Widgets Editor on after_setup_theme instead of widgets_init.
This better aligns with developer expectations, as `add_theme_support()` and `remove_theme_support()` are meant to be called within functions attached to the `after_setup_theme` hook. This also adds the `widgets-block-editor` feature to the docblock for `add_theme_support()`. Props kevin940726, caseymilne, jamesros161, noisysocks, Mamaduka, audrasjb, zieladam, hellofromTonya, desrosj. Fixes #53424. git-svn-id: https://develop.svn.wordpress.org/trunk@51214 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1801,8 +1801,6 @@ function wp_widgets_init() {
|
||||
|
||||
register_widget( 'WP_Widget_Block' );
|
||||
|
||||
add_theme_support( 'widgets-block-editor' );
|
||||
|
||||
/**
|
||||
* Fires after all default WordPress widgets have been registered.
|
||||
*
|
||||
@@ -1811,6 +1809,18 @@ function wp_widgets_init() {
|
||||
do_action( 'widgets_init' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables the widgets block editor. This is hooked into 'after_setup_theme' so
|
||||
* that the block editor is enabled by default but can be disabled by themes.
|
||||
*
|
||||
* @since 5.8.0
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function wp_setup_widgets_block_editor() {
|
||||
add_theme_support( 'widgets-block-editor' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not to use the block editor to manage widgets. Defaults to true
|
||||
* unless a theme has removed support for widgets-block-editor or a plugin has
|
||||
|
||||
Reference in New Issue
Block a user