network_admin_url

Retrieves the URL to the admin area for the network.

Description

(string) network_admin_url( (string) $path = '', (string) $scheme = 'admin' ); 

Returns (string)

Admin URL link with optional path appended.

Parameters (2)

0. $path — Optional. (string) => ''
Path relative to the admin URL. Default empty.
1. $scheme — Optional. (string) => 'admin'
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.

Usage

  1. if ( !function_exists( 'network_admin_url' ) ) { 
  2. require_once ABSPATH . WPINC . '/link-template.php'; 
  3.  
  4. // Optional path relative to the admin URL. Default empty. 
  5. $path = ''; 
  6.  
  7. // Optional. The scheme to use. Default is 'admin', which obeys force_ssl_admin() 
  8. // and is_ssl(). 'http' or 'https' can be passed to force those schemes. 
  9. $scheme = 'admin'; 
  10.  
  11. // NOTICE! Understand what this does before running. 
  12. $result = network_admin_url($path, $scheme); 
  13.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/link-template.php  
  1. function network_admin_url( $path = '', $scheme = 'admin' ) { 
  2. if ( ! is_multisite() ) 
  3. return admin_url( $path, $scheme ); 
  4.  
  5. $url = network_site_url('wp-admin/network/', $scheme); 
  6.  
  7. if ( $path && is_string( $path ) ) 
  8. $url .= ltrim($path, '/'); 
  9.  
  10. /** 
  11. * Filters the network admin URL. 
  12. * @since 3.0.0 
  13. * @param string $url The complete network admin URL including scheme and path. 
  14. * @param string $path Path relative to the network admin URL. Blank string if 
  15. * no path is specified. 
  16. */ 
  17. return apply_filters( 'network_admin_url', $url, $path );