WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/network admin url

Description

The network_admin_url template tag retrieves the URL to the Network Admin area for the current site with the appropriate protocol, "https" if is_ssl() and "http" otherwise. If scheme is "http" or "https", is_ssl() is overridden.

If the site is not setup as multisite, admin_url() will be used instead.

Usage

<?php network_admin_url$path$scheme ); ?>

Default Usage

<?php $url network_admin_url(); ?>

Parameters

$path
(string) (optional) Path relative to the admin URL.
Default: None
$scheme
(string) (optional) The scheme to use. Default is 'admin', which obeys force_ssl_admin() and is_ssl(). "http" or "https" can be passed to force those schemes. The function uses network_site_url(), so allowed values include any accepted by that function.
Default: 'admin'

Return

(string) 
Admin URL link with optional path appended.

Examples

$url = network_admin_url();
echo $url;

Output: http://www.example.com/wp-admin/network/

(protocol will be https when appropriate)

// generate url path to Users -> Add New page in the admin and force https
$url = network_admin_url( 'user-new.php', 'https' );
echo $url;

Output: https://www.example.com/wp-admin/network/user-new.php

Notes

Changelog

Source Code

network_admin_url() is located in wp-includes/link-template.php.

Related

WordPress Directories:
home_url() Home URL http://www.example.com
site_url() Site directory URL http://www.example.com or http://www.example.com/wordpress
admin_url() Admin directory URL http://www.example.com/wp-admin
includes_url() Includes directory URL http://www.example.com/wp-includes
content_url() Content directory URL http://www.example.com/wp-content
plugins_url() Plugins directory URL http://www.example.com/wp-content/plugins
theme_url() Themes directory URL (#18302) http://www.example.com/wp-content/themes
wp_upload_dir() Upload directory URL (returns an array) http://www.example.com/wp-content/uploads
See also index of Function Reference and index of Template Tags.