network_edit_site_nav

The timeline below displays how wordpress function network_edit_site_nav has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Outputs the HTML for a network's "Edit Site" tabular interface.
 *
 * @since 4.6.0
 *
 * @global string $pagenow The filename of the current screen.
 *
 * @param array $args {
 *     Optional. Array or string of Query parameters. Default empty array.
 *
 *     @type int    $blog_id  The site ID. Default is the current site.
 *     @type array  $links    The tabs to include with (label|url|cap) keys.
 *     @type string $selected The ID of the selected link.
 * }
 */
function network_edit_site_nav($args = array())
{
    /**
     * Filters the links that appear on site-editing network pages.
     *
     * Default links: 'site-info', 'site-users', 'site-themes', and 'site-settings'.
     *
     * @since 4.6.0
     *
     * @param array $links {
     *     An array of link data representing individual network admin pages.
     *
     *     @type array $link_slug {
     *         An array of information about the individual link to a page.
     *
     *         $type string $label Label to use for the link.
     *         $type string $url   URL, relative to `network_admin_url()` to use for the link.
     *         $type string $cap   Capability required to see the link.
     *     }
     * }
     */
    $links = apply_filters('network_edit_site_nav_links', array('site-info' => array('label' => __('Info'), 'url' => 'site-info.php', 'cap' => 'manage_sites'), 'site-users' => array('label' => __('Users'), 'url' => 'site-users.php', 'cap' => 'manage_sites'), 'site-themes' => array('label' => __('Themes'), 'url' => 'site-themes.php', 'cap' => 'manage_sites'), 'site-settings' => array('label' => __('Settings'), 'url' => 'site-settings.php', 'cap' => 'manage_sites')));
    // Parse arguments.
    $parsed_args = wp_parse_args($args, array('blog_id' => isset($_GET['blog_id']) ? (int) $_GET['blog_id'] : 0, 'links' => $links, 'selected' => 'site-info'));
    // Setup the links array.
    $screen_links = array();
    // Loop through tabs.
    foreach ($parsed_args['links'] as $link_id => $link) {
        // Skip link if user can't access.
        if (!current_user_can($link['cap'], $parsed_args['blog_id'])) {
            continue;
        }
        // Link classes.
        $classes = array('nav-tab');
        // Aria-current attribute.
        $aria_current = '';
        // Selected is set by the parent OR assumed by the $pagenow global.
        if ($parsed_args['selected'] === $link_id || $link['url'] === $GLOBALS['pagenow']) {
            $classes[] = 'nav-tab-active';
            $aria_current = ' aria-current="page"';
        }
        // Escape each class.
        $esc_classes = implode(' ', $classes);
        // Get the URL for this link.
        $url = add_query_arg(array('id' => $parsed_args['blog_id']), network_admin_url($link['url']));
        // Add link to nav links.
        $screen_links[$link_id] = '<a href="' . esc_url($url) . '" id="' . esc_attr($link_id) . '" class="' . $esc_classes . '"' . $aria_current . '>' . esc_html($link['label']) . '</a>';
    }
    // All done!
    echo '<nav class="nav-tab-wrapper wp-clearfix" aria-label="' . esc_attr__('Secondary menu') . '">';
    echo implode('', $screen_links);
    echo '</nav>';
}

WordPress Version: 5.7

/**
 * Outputs the HTML for a network's "Edit Site" tabular interface.
 *
 * @since 4.6.0
 *
 * @global string $pagenow
 *
 * @param array $args {
 *     Optional. Array or string of Query parameters. Default empty array.
 *
 *     @type int    $blog_id  The site ID. Default is the current site.
 *     @type array  $links    The tabs to include with (label|url|cap) keys.
 *     @type string $selected The ID of the selected link.
 * }
 */
function network_edit_site_nav($args = array())
{
    /**
     * Filters the links that appear on site-editing network pages.
     *
     * Default links: 'site-info', 'site-users', 'site-themes', and 'site-settings'.
     *
     * @since 4.6.0
     *
     * @param array $links {
     *     An array of link data representing individual network admin pages.
     *
     *     @type array $link_slug {
     *         An array of information about the individual link to a page.
     *
     *         $type string $label Label to use for the link.
     *         $type string $url   URL, relative to `network_admin_url()` to use for the link.
     *         $type string $cap   Capability required to see the link.
     *     }
     * }
     */
    $links = apply_filters('network_edit_site_nav_links', array('site-info' => array('label' => __('Info'), 'url' => 'site-info.php', 'cap' => 'manage_sites'), 'site-users' => array('label' => __('Users'), 'url' => 'site-users.php', 'cap' => 'manage_sites'), 'site-themes' => array('label' => __('Themes'), 'url' => 'site-themes.php', 'cap' => 'manage_sites'), 'site-settings' => array('label' => __('Settings'), 'url' => 'site-settings.php', 'cap' => 'manage_sites')));
    // Parse arguments.
    $parsed_args = wp_parse_args($args, array('blog_id' => isset($_GET['blog_id']) ? (int) $_GET['blog_id'] : 0, 'links' => $links, 'selected' => 'site-info'));
    // Setup the links array.
    $screen_links = array();
    // Loop through tabs.
    foreach ($parsed_args['links'] as $link_id => $link) {
        // Skip link if user can't access.
        if (!current_user_can($link['cap'], $parsed_args['blog_id'])) {
            continue;
        }
        // Link classes.
        $classes = array('nav-tab');
        // Aria-current attribute.
        $aria_current = '';
        // Selected is set by the parent OR assumed by the $pagenow global.
        if ($parsed_args['selected'] === $link_id || $link['url'] === $GLOBALS['pagenow']) {
            $classes[] = 'nav-tab-active';
            $aria_current = ' aria-current="page"';
        }
        // Escape each class.
        $esc_classes = implode(' ', $classes);
        // Get the URL for this link.
        $url = add_query_arg(array('id' => $parsed_args['blog_id']), network_admin_url($link['url']));
        // Add link to nav links.
        $screen_links[$link_id] = '<a href="' . esc_url($url) . '" id="' . esc_attr($link_id) . '" class="' . $esc_classes . '"' . $aria_current . '>' . esc_html($link['label']) . '</a>';
    }
    // All done!
    echo '<nav class="nav-tab-wrapper wp-clearfix" aria-label="' . esc_attr__('Secondary menu') . '">';
    echo implode('', $screen_links);
    echo '</nav>';
}

WordPress Version: 5.5

/**
 * Outputs the HTML for a network's "Edit Site" tabular interface.
 *
 * @since 4.6.0
 *
 * @param array $args {
 *     Optional. Array or string of Query parameters. Default empty array.
 *
 *     @type int    $blog_id  The site ID. Default is the current site.
 *     @type array  $links    The tabs to include with (label|url|cap) keys.
 *     @type string $selected The ID of the selected link.
 * }
 */
function network_edit_site_nav($args = array())
{
    /**
     * Filters the links that appear on site-editing network pages.
     *
     * Default links: 'site-info', 'site-users', 'site-themes', and 'site-settings'.
     *
     * @since 4.6.0
     *
     * @param array $links {
     *     An array of link data representing individual network admin pages.
     *
     *     @type array $link_slug {
     *         An array of information about the individual link to a page.
     *
     *         $type string $label Label to use for the link.
     *         $type string $url   URL, relative to `network_admin_url()` to use for the link.
     *         $type string $cap   Capability required to see the link.
     *     }
     * }
     */
    $links = apply_filters('network_edit_site_nav_links', array('site-info' => array('label' => __('Info'), 'url' => 'site-info.php', 'cap' => 'manage_sites'), 'site-users' => array('label' => __('Users'), 'url' => 'site-users.php', 'cap' => 'manage_sites'), 'site-themes' => array('label' => __('Themes'), 'url' => 'site-themes.php', 'cap' => 'manage_sites'), 'site-settings' => array('label' => __('Settings'), 'url' => 'site-settings.php', 'cap' => 'manage_sites')));
    // Parse arguments.
    $parsed_args = wp_parse_args($args, array('blog_id' => isset($_GET['blog_id']) ? (int) $_GET['blog_id'] : 0, 'links' => $links, 'selected' => 'site-info'));
    // Setup the links array.
    $screen_links = array();
    // Loop through tabs.
    foreach ($parsed_args['links'] as $link_id => $link) {
        // Skip link if user can't access.
        if (!current_user_can($link['cap'], $parsed_args['blog_id'])) {
            continue;
        }
        // Link classes.
        $classes = array('nav-tab');
        // Aria-current attribute.
        $aria_current = '';
        // Selected is set by the parent OR assumed by the $pagenow global.
        if ($parsed_args['selected'] === $link_id || $link['url'] === $GLOBALS['pagenow']) {
            $classes[] = 'nav-tab-active';
            $aria_current = ' aria-current="page"';
        }
        // Escape each class.
        $esc_classes = implode(' ', $classes);
        // Get the URL for this link.
        $url = add_query_arg(array('id' => $parsed_args['blog_id']), network_admin_url($link['url']));
        // Add link to nav links.
        $screen_links[$link_id] = '<a href="' . esc_url($url) . '" id="' . esc_attr($link_id) . '" class="' . $esc_classes . '"' . $aria_current . '>' . esc_html($link['label']) . '</a>';
    }
    // All done!
    echo '<nav class="nav-tab-wrapper wp-clearfix" aria-label="' . esc_attr__('Secondary menu') . '">';
    echo implode('', $screen_links);
    echo '</nav>';
}

WordPress Version: 5.4

/**
 * Outputs the HTML for a network's "Edit Site" tabular interface.
 *
 * @since 4.6.0
 *
 * @param $args {
 *     Optional. Array or string of Query parameters. Default empty array.
 *
 *     @type int    $blog_id  The site ID. Default is the current site.
 *     @type array  $links    The tabs to include with (label|url|cap) keys.
 *     @type string $selected The ID of the selected link.
 * }
 */
function network_edit_site_nav($args = array())
{
    /**
     * Filters the links that appear on site-editing network pages.
     *
     * Default links: 'site-info', 'site-users', 'site-themes', and 'site-settings'.
     *
     * @since 4.6.0
     *
     * @param array $links {
     *     An array of link data representing individual network admin pages.
     *
     *     @type array $link_slug {
     *         An array of information about the individual link to a page.
     *
     *         $type string $label Label to use for the link.
     *         $type string $url   URL, relative to `network_admin_url()` to use for the link.
     *         $type string $cap   Capability required to see the link.
     *     }
     * }
     */
    $links = apply_filters('network_edit_site_nav_links', array('site-info' => array('label' => __('Info'), 'url' => 'site-info.php', 'cap' => 'manage_sites'), 'site-users' => array('label' => __('Users'), 'url' => 'site-users.php', 'cap' => 'manage_sites'), 'site-themes' => array('label' => __('Themes'), 'url' => 'site-themes.php', 'cap' => 'manage_sites'), 'site-settings' => array('label' => __('Settings'), 'url' => 'site-settings.php', 'cap' => 'manage_sites')));
    // Parse arguments.
    $parsed_args = wp_parse_args($args, array('blog_id' => isset($_GET['blog_id']) ? (int) $_GET['blog_id'] : 0, 'links' => $links, 'selected' => 'site-info'));
    // Setup the links array.
    $screen_links = array();
    // Loop through tabs.
    foreach ($parsed_args['links'] as $link_id => $link) {
        // Skip link if user can't access.
        if (!current_user_can($link['cap'], $parsed_args['blog_id'])) {
            continue;
        }
        // Link classes.
        $classes = array('nav-tab');
        // Aria-current attribute.
        $aria_current = '';
        // Selected is set by the parent OR assumed by the $pagenow global.
        if ($parsed_args['selected'] === $link_id || $link['url'] === $GLOBALS['pagenow']) {
            $classes[] = 'nav-tab-active';
            $aria_current = ' aria-current="page"';
        }
        // Escape each class.
        $esc_classes = implode(' ', $classes);
        // Get the URL for this link.
        $url = add_query_arg(array('id' => $parsed_args['blog_id']), network_admin_url($link['url']));
        // Add link to nav links.
        $screen_links[$link_id] = '<a href="' . esc_url($url) . '" id="' . esc_attr($link_id) . '" class="' . $esc_classes . '"' . $aria_current . '>' . esc_html($link['label']) . '</a>';
    }
    // All done!
    echo '<nav class="nav-tab-wrapper wp-clearfix" aria-label="' . esc_attr__('Secondary menu') . '">';
    echo implode('', $screen_links);
    echo '</nav>';
}

WordPress Version: 5.3

/**
 * Outputs the HTML for a network's "Edit Site" tabular interface.
 *
 * @since 4.6.0
 *
 * @param $args {
 *     Optional. Array or string of Query parameters. Default empty array.
 *
 *     @type int    $blog_id  The site ID. Default is the current site.
 *     @type array  $links    The tabs to include with (label|url|cap) keys.
 *     @type string $selected The ID of the selected link.
 * }
 */
function network_edit_site_nav($args = array())
{
    /**
     * Filters the links that appear on site-editing network pages.
     *
     * Default links: 'site-info', 'site-users', 'site-themes', and 'site-settings'.
     *
     * @since 4.6.0
     *
     * @param array $links {
     *     An array of link data representing individual network admin pages.
     *
     *     @type array $link_slug {
     *         An array of information about the individual link to a page.
     *
     *         $type string $label Label to use for the link.
     *         $type string $url   URL, relative to `network_admin_url()` to use for the link.
     *         $type string $cap   Capability required to see the link.
     *     }
     * }
     */
    $links = apply_filters('network_edit_site_nav_links', array('site-info' => array('label' => __('Info'), 'url' => 'site-info.php', 'cap' => 'manage_sites'), 'site-users' => array('label' => __('Users'), 'url' => 'site-users.php', 'cap' => 'manage_sites'), 'site-themes' => array('label' => __('Themes'), 'url' => 'site-themes.php', 'cap' => 'manage_sites'), 'site-settings' => array('label' => __('Settings'), 'url' => 'site-settings.php', 'cap' => 'manage_sites')));
    // Parse arguments
    $parsed_args = wp_parse_args($args, array('blog_id' => isset($_GET['blog_id']) ? (int) $_GET['blog_id'] : 0, 'links' => $links, 'selected' => 'site-info'));
    // Setup the links array
    $screen_links = array();
    // Loop through tabs
    foreach ($parsed_args['links'] as $link_id => $link) {
        // Skip link if user can't access
        if (!current_user_can($link['cap'], $parsed_args['blog_id'])) {
            continue;
        }
        // Link classes
        $classes = array('nav-tab');
        // Aria-current attribute.
        $aria_current = '';
        // Selected is set by the parent OR assumed by the $pagenow global
        if ($parsed_args['selected'] === $link_id || $link['url'] === $GLOBALS['pagenow']) {
            $classes[] = 'nav-tab-active';
            $aria_current = ' aria-current="page"';
        }
        // Escape each class
        $esc_classes = implode(' ', $classes);
        // Get the URL for this link
        $url = add_query_arg(array('id' => $parsed_args['blog_id']), network_admin_url($link['url']));
        // Add link to nav links
        $screen_links[$link_id] = '<a href="' . esc_url($url) . '" id="' . esc_attr($link_id) . '" class="' . $esc_classes . '"' . $aria_current . '>' . esc_html($link['label']) . '</a>';
    }
    // All done!
    echo '<nav class="nav-tab-wrapper wp-clearfix" aria-label="' . esc_attr__('Secondary menu') . '">';
    echo implode('', $screen_links);
    echo '</nav>';
}

WordPress Version: 2.1

/**
 * Outputs the HTML for a network's "Edit Site" tabular interface.
 *
 * @since 4.6.0
 *
 * @param $args {
 *     Optional. Array or string of Query parameters. Default empty array.
 *
 *     @type int    $blog_id  The site ID. Default is the current site.
 *     @type array  $links    The tabs to include with (label|url|cap) keys.
 *     @type string $selected The ID of the selected link.
 * }
 */
function network_edit_site_nav($args = array())
{
    /**
     * Filters the links that appear on site-editing network pages.
     *
     * Default links: 'site-info', 'site-users', 'site-themes', and 'site-settings'.
     *
     * @since 4.6.0
     *
     * @param array $links {
     *     An array of link data representing individual network admin pages.
     *
     *     @type array $link_slug {
     *         An array of information about the individual link to a page.
     *
     *         $type string $label Label to use for the link.
     *         $type string $url   URL, relative to `network_admin_url()` to use for the link.
     *         $type string $cap   Capability required to see the link.
     *     }
     * }
     */
    $links = apply_filters('network_edit_site_nav_links', array('site-info' => array('label' => __('Info'), 'url' => 'site-info.php', 'cap' => 'manage_sites'), 'site-users' => array('label' => __('Users'), 'url' => 'site-users.php', 'cap' => 'manage_sites'), 'site-themes' => array('label' => __('Themes'), 'url' => 'site-themes.php', 'cap' => 'manage_sites'), 'site-settings' => array('label' => __('Settings'), 'url' => 'site-settings.php', 'cap' => 'manage_sites')));
    // Parse arguments
    $r = wp_parse_args($args, array('blog_id' => isset($_GET['blog_id']) ? (int) $_GET['blog_id'] : 0, 'links' => $links, 'selected' => 'site-info'));
    // Setup the links array
    $screen_links = array();
    // Loop through tabs
    foreach ($r['links'] as $link_id => $link) {
        // Skip link if user can't access
        if (!current_user_can($link['cap'], $r['blog_id'])) {
            continue;
        }
        // Link classes
        $classes = array('nav-tab');
        // Aria-current attribute.
        $aria_current = '';
        // Selected is set by the parent OR assumed by the $pagenow global
        if ($r['selected'] === $link_id || $link['url'] === $GLOBALS['pagenow']) {
            $classes[] = 'nav-tab-active';
            $aria_current = ' aria-current="page"';
        }
        // Escape each class
        $esc_classes = implode(' ', $classes);
        // Get the URL for this link
        $url = add_query_arg(array('id' => $r['blog_id']), network_admin_url($link['url']));
        // Add link to nav links
        $screen_links[$link_id] = '<a href="' . esc_url($url) . '" id="' . esc_attr($link_id) . '" class="' . $esc_classes . '"' . $aria_current . '>' . esc_html($link['label']) . '</a>';
    }
    // All done!
    echo '<nav class="nav-tab-wrapper wp-clearfix" aria-label="' . esc_attr__('Secondary menu') . '">';
    echo implode('', $screen_links);
    echo '</nav>';
}

WordPress Version: 5.2

/**
 * Outputs the HTML for a network's "Edit Site" tabular interface.
 *
 * @since 4.6.0
 *
 * @param $args {
 *     Optional. Array or string of Query parameters. Default empty array.
 *
 *     @type int    $blog_id  The site ID. Default is the current site.
 *     @type array  $links    The tabs to include with (label|url|cap) keys.
 *     @type string $selected The ID of the selected link.
 * }
 */
function network_edit_site_nav($args = array())
{
    /**
     * Filters the links that appear on site-editing network pages.
     *
     * Default links: 'site-info', 'site-users', 'site-themes', and 'site-settings'.
     *
     * @since 4.6.0
     *
     * @param array $links {
     *     An array of link data representing individual network admin pages.
     *
     *     @type array $link_slug {
     *         An array of information about the individual link to a page.
     *
     *         $type string $label Label to use for the link.
     *         $type string $url   URL, relative to `network_admin_url()` to use for the link.
     *         $type string $cap   Capability required to see the link.
     *     }
     * }
     */
    $links = apply_filters('network_edit_site_nav_links', array('site-info' => array('label' => __('Info'), 'url' => 'site-info.php', 'cap' => 'manage_sites'), 'site-users' => array('label' => __('Users'), 'url' => 'site-users.php', 'cap' => 'manage_sites'), 'site-themes' => array('label' => __('Themes'), 'url' => 'site-themes.php', 'cap' => 'manage_sites'), 'site-settings' => array('label' => __('Settings'), 'url' => 'site-settings.php', 'cap' => 'manage_sites')));
    // Parse arguments
    $r = wp_parse_args($args, array('blog_id' => isset($_GET['blog_id']) ? (int) $_GET['blog_id'] : 0, 'links' => $links, 'selected' => 'site-info'));
    // Setup the links array
    $screen_links = array();
    // Loop through tabs
    foreach ($r['links'] as $link_id => $link) {
        // Skip link if user can't access
        if (!current_user_can($link['cap'], $r['blog_id'])) {
            continue;
        }
        // Link classes
        $classes = array('nav-tab');
        // Selected is set by the parent OR assumed by the $pagenow global
        if ($r['selected'] === $link_id || $link['url'] === $GLOBALS['pagenow']) {
            $classes[] = 'nav-tab-active';
        }
        // Escape each class
        $esc_classes = implode(' ', $classes);
        // Get the URL for this link
        $url = add_query_arg(array('id' => $r['blog_id']), network_admin_url($link['url']));
        // Add link to nav links
        $screen_links[$link_id] = '<a href="' . esc_url($url) . '" id="' . esc_attr($link_id) . '" class="' . $esc_classes . '">' . esc_html($link['label']) . '</a>';
    }
    // All done!
    echo '<nav class="nav-tab-wrapper wp-clearfix" aria-label="' . esc_attr__('Secondary menu') . '">';
    echo implode('', $screen_links);
    echo '</nav>';
}

WordPress Version: 4.6

/**
 * Outputs the HTML for a network's "Edit Site" tabular interface.
 *
 * @since 4.6.0
 *
 * @param $args {
 *     Optional. Array or string of Query parameters. Default empty array.
 *
 *     @type int    $blog_id  The site ID. Default is the current site.
 *     @type array  $links    The tabs to include with (label|url|cap) keys.
 *     @type string $selected The ID of the selected link.
 * }
 */
function network_edit_site_nav($args = array())
{
    /**
     * Filters the links that appear on site-editing network pages.
     *
     * Default links: 'site-info', 'site-users', 'site-themes', and 'site-settings'.
     *
     * @since 4.6.0
     *
     * @param array $links {
     *     An array of link data representing individual network admin pages.
     *
     *     @type array $link_slug {
     *         An array of information about the individual link to a page.
     *
     *         $type string $label Label to use for the link.
     *         $type string $url   URL, relative to `network_admin_url()` to use for the link.
     *         $type string $cap   Capability required to see the link.
     *     }
     * }
     */
    $links = apply_filters('network_edit_site_nav_links', array('site-info' => array('label' => __('Info'), 'url' => 'site-info.php', 'cap' => 'manage_sites'), 'site-users' => array('label' => __('Users'), 'url' => 'site-users.php', 'cap' => 'manage_sites'), 'site-themes' => array('label' => __('Themes'), 'url' => 'site-themes.php', 'cap' => 'manage_sites'), 'site-settings' => array('label' => __('Settings'), 'url' => 'site-settings.php', 'cap' => 'manage_sites')));
    // Parse arguments
    $r = wp_parse_args($args, array('blog_id' => isset($_GET['blog_id']) ? (int) $_GET['blog_id'] : 0, 'links' => $links, 'selected' => 'site-info'));
    // Setup the links array
    $screen_links = array();
    // Loop through tabs
    foreach ($r['links'] as $link_id => $link) {
        // Skip link if user can't access
        if (!current_user_can($link['cap'], $r['blog_id'])) {
            continue;
        }
        // Link classes
        $classes = array('nav-tab');
        // Selected is set by the parent OR assumed by the $pagenow global
        if ($r['selected'] === $link_id || $link['url'] === $GLOBALS['pagenow']) {
            $classes[] = 'nav-tab-active';
        }
        // Escape each class
        $esc_classes = implode(' ', $classes);
        // Get the URL for this link
        $url = add_query_arg(array('id' => $r['blog_id']), network_admin_url($link['url']));
        // Add link to nav links
        $screen_links[$link_id] = '<a href="' . esc_url($url) . '" id="' . esc_attr($link_id) . '" class="' . $esc_classes . '">' . esc_html($link['label']) . '</a>';
    }
    // All done!
    echo '<h2 class="nav-tab-wrapper wp-clearfix">';
    echo implode('', $screen_links);
    echo '</h2>';
}