From fb3ce8ed15811d4bd6390b3ce5fca8ec94a5151e Mon Sep 17 00:00:00 2001 From: joedolson Date: Mon, 12 Feb 2024 20:53:12 +0000 Subject: [PATCH] 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 --- wp-includes/admin-bar.php | 12 ++++++++++++ wp-includes/version.php | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/wp-includes/admin-bar.php b/wp-includes/admin-bar.php index 3eba2668fa..4f5f2ff70d 100644 --- a/wp-includes/admin-bar.php +++ b/wp-includes/admin-bar.php @@ -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' ), + ) + ); + } } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index 931b67af2c..a275d33ad5 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @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.