self_admin_url

Retrieves the URL to the admin area for either the current site or the network depending on context.

Description

(string) self_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( 'self_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 = self_admin_url($path, $scheme); 
  13.  

Defined (1)

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

/wp-includes/link-template.php  
  1. function self_admin_url( $path = '', $scheme = 'admin' ) { 
  2. if ( is_network_admin() ) 
  3. return network_admin_url($path, $scheme); 
  4. elseif ( is_user_admin() ) 
  5. return user_admin_url($path, $scheme); 
  6. else 
  7. return admin_url($path, $scheme);