admin_url

Retrieves the URL to the admin area for the current site.

Description

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

Defined (2)

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

/wp-includes/link-template.php  
  1. function admin_url( $path = '', $scheme = 'admin' ) { 
  2. return get_admin_url( null, $path, $scheme ); 
/wp-admin/includes/noop.php  
  1. function admin_url() {}