Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link to widgets.php instead of themes.php?page=gutenberg-widgets #32299

Merged
merged 4 commits into from
May 31, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions lib/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ function gutenberg_menu() {
'gutenberg'
);

if ( gutenberg_use_widgets_block_editor() ) {
if (
gutenberg_use_widgets_block_editor() &&
! function_exists( 'wp_use_widgets_block_editor' )
) {
add_theme_page(
__( 'Widgets', 'gutenberg' ),
__( 'Widgets', 'gutenberg' ),
Expand Down Expand Up @@ -113,7 +116,11 @@ function gutenberg_site_editor_menu() {
* @param WP_Admin_Bar $wp_admin_bar Core class used to implement the Toolbar API.
*/
function modify_admin_bar( $wp_admin_bar ) {
if ( gutenberg_use_widgets_block_editor() && $wp_admin_bar->get_node( 'widgets' ) !== null ) {
if (
gutenberg_use_widgets_block_editor() &&
! function_exists( 'wp_use_widgets_block_editor' ) &&
$wp_admin_bar->get_node( 'widgets' ) !== null
) {
$wp_admin_bar->add_menu(
array(
'id' => 'widgets',
Expand All @@ -137,7 +144,10 @@ function modify_welcome_panel() {
ob_start();
wp_welcome_panel();
$welcome_panel = ob_get_clean();
if ( gutenberg_use_widgets_block_editor() ) {
if (
gutenberg_use_widgets_block_editor() &&
! function_exists( 'wp_use_widgets_block_editor' )
) {
echo str_replace(
admin_url( 'widgets.php' ),
admin_url( 'themes.php?page=gutenberg-widgets' ),
Expand Down Expand Up @@ -177,5 +187,4 @@ function register_site_icon_url( $response ) {

add_filter( 'rest_index', 'register_site_icon_url' );

add_theme_support( 'widgets-block-editor' );
noisysocks marked this conversation as resolved.
Show resolved Hide resolved
add_theme_support( 'block-templates' );
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default function WidgetAreas( { selectedWidgetAreaId } ) {
<Button
href={ addQueryArgs( 'customize.php', {
'autofocus[panel]': 'widgets',
return: 'themes.php?page=gutenberg-widgets',
return: 'widgets.php',
noisysocks marked this conversation as resolved.
Show resolved Hide resolved
} ) }
variant="tertiary"
>
Expand Down