Toolbar: Add adminbar link for new sites in network installs.

Add a link that allows network administrators to go to the new site page from the "New" menu in the adminbar. 

Props johnjamesjacoby, sabernhardt, joedolson, rajinsharwar, huzaifaalmesbah.
Fixes #41104.
Built from https://develop.svn.wordpress.org/trunk@57600


git-svn-id: http://core.svn.wordpress.org/trunk@57101 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
joedolson
2024-02-12 20:53:12 +00:00
parent 811de39c6f
commit fb3ce8ed15
2 changed files with 13 additions and 1 deletions

View File

@@ -938,6 +938,7 @@ function wp_admin_bar_edit_menu( $wp_admin_bar ) {
* Adds "Add New" menu. * Adds "Add New" menu.
* *
* @since 3.1.0 * @since 3.1.0
* @since 6.5.0 Added a New Site link for network installations.
* *
* @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
*/ */
@@ -1008,6 +1009,17 @@ function wp_admin_bar_new_content_menu( $wp_admin_bar ) {
) )
); );
} }
if ( is_multisite() && current_user_can( 'create_sites' ) ) {
$wp_admin_bar->add_node(
array(
'parent' => 'new-content',
'id' => 'add-new-site',
'title' => _x( 'Site', 'add new from admin bar' ),
'href' => network_admin_url( 'site-new.php' ),
)
);
}
} }
/** /**

View File

@@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.5-alpha-57599'; $wp_version = '6.5-alpha-57600';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.