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

Override Site Editor URLs to use plugin page #38232

Merged
merged 2 commits into from
Jan 26, 2022
Merged
Changes from all commits
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: 16 additions & 1 deletion lib/compat/wordpress-5.9/admin-menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,24 @@ function gutenberg_adminbar_items( $wp_admin_bar ) {
);
}
}

add_action( 'admin_bar_menu', 'gutenberg_adminbar_items', 50 );

/**
* Override Site Editor URLs to use plugin page.
*
* @param string $url Admin URL link with path.
* @param string $path Path relative to the admin URL.
* @return string Modified Admin URL link.
*/
function gutenberg_override_site_editor_urls( $url, $path ) {
if ( 'site-editor.php' === $path ) {
$url = str_replace( $path, 'themes.php?page=gutenberg-edit-site', $url );
}

return $url;
}
add_filter( 'admin_url', 'gutenberg_override_site_editor_urls', 10, 2 );

/**
* Check if any plugin, or theme features, are using the Customizer.
*
Expand Down