Make WordPress Core


Ignore:
Timestamp:
02/12/2024 08:51:45 PM (9 months ago)
Author:
joedolson
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/admin-bar.php

    r57188 r57600  
    939939 *
    940940 * @since 3.1.0
     941 * @since 6.5.0 Added a New Site link for network installations.
    941942 *
    942943 * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
     
    10061007                'title'  => $title,
    10071008                'href'   => admin_url( $link ),
     1009            )
     1010        );
     1011    }
     1012
     1013    if ( is_multisite() && current_user_can( 'create_sites' ) ) {
     1014        $wp_admin_bar->add_node(
     1015            array(
     1016                'parent' => 'new-content',
     1017                'id'     => 'add-new-site',
     1018                'title'  => _x( 'Site', 'add new from admin bar' ),
     1019                'href'   => network_admin_url( 'site-new.php' ),
    10081020            )
    10091021        );
Note: See TracChangeset for help on using the changeset viewer.