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.

git-svn-id: https://develop.svn.wordpress.org/trunk@57600 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Joe Dolson 2024-02-12 20:51:45 +00:00
parent 9087615a4f
commit ef53283061

View File

@ -938,6 +938,7 @@ function wp_admin_bar_edit_menu( $wp_admin_bar ) {
* Adds "Add New" menu.
*
* @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.
*/
@ -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' ),
)
);
}
}
/**