Skip to content

Commit 7e3b648

Browse files
committed
Widgets: Add missing actions to widgets block editor
Adds the `'sidebar_admin-setup'`, `'sidebar_admin_page'`, and `current_theme_supports( 'widgets' )` check to the widgets block editor so that the block editor screen is more compatible with the classic screen. Fixes #53288. Props isabel_brison. git-svn-id: https://develop.svn.wordpress.org/trunk@51061 602fd350-edb4-49c9-b593-d223f7449a82
1 parent a46baca commit 7e3b648

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

src/wp-admin/widgets-form-blocks.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@
5555
/** This action is documented in wp-admin/edit-form-blocks.php */
5656
do_action( 'enqueue_block_editor_assets' );
5757

58+
/** This action is documented in wp-admin/widgets-form.php */
59+
do_action( 'sidebar_admin_setup' );
60+
5861
require_once ABSPATH . 'wp-admin/admin-header.php';
5962

6063
/** This action is documented in wp-admin/widgets-form.php */
@@ -64,4 +67,7 @@
6467
<div id="widgets-editor" class="blocks-widgets-container"></div>
6568

6669
<?php
70+
/** This action is documented in wp-admin/widgets-form.php */
71+
do_action( 'sidebar_admin_page' );
72+
6773
require_once ABSPATH . 'wp-admin/admin-footer.php';

src/wp-admin/widgets-form.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,6 @@
7272
'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
7373
);
7474

75-
if ( ! current_theme_supports( 'widgets' ) ) {
76-
wp_die( __( 'The theme you are currently using isn&#8217;t widget-aware, meaning that it has no sidebars that you are able to change. For information on making your theme widget-aware, please <a href="https://developer.wordpress.org/themes/functionality/widgets/">follow these instructions</a>.' ) );
77-
}
78-
7975
// These are the widgets grouped by sidebar.
8076
$sidebars_widgets = wp_get_sidebars_widgets();
8177

src/wp-admin/widgets.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
);
2121
}
2222

23+
if ( ! current_theme_supports( 'widgets' ) ) {
24+
wp_die( __( 'The theme you are currently using isn&#8217;t widget-aware, meaning that it has no sidebars that you are able to change. For information on making your theme widget-aware, please <a href="https://developer.wordpress.org/themes/functionality/widgets/">follow these instructions</a>.' ) );
25+
}
26+
2327
$title = __( 'Widgets' );
2428
$parent_file = 'themes.php';
2529

0 commit comments

Comments
 (0)