WordPress at Your Fingertips

admin_url() WP 2.6.0

Retrieves the URL to the admin area for the current site. Takes into account protocols (http and https).

To get a link to the network admin panel page, use the network_admin_url() function.

1 time — 0.001915 sec (very slow) | 50000 times — 2.76 sec (fast) | PHP 7.1.2, WP 4.7.4

No Hooks.


String. Admin URL link with optional path appended.


admin_url( $path, $scheme );
Optional path relative to the admin URL.
Default: ''

The scheme (protocol) can be passed to force those schemes.

  • http - specify the Protocol forcibly.
  • https - specify the Protocol forcibly.
  • relative - return relative URL (without domain).

Default: 'admin'


#1 Demonstration of what the function retrieve

The Protocol will be changed automatically if necessary.

$url = admin_url();
echo $url; //> http://example.com/wp-admin/

#2 Get a link to a specific admin page

Posts > Categories and force https scheme:

$url = admin_url( 'edit-tags.php?taxonomy=category', 'https' );
echo $url; //> https://site.com/wp-admin/edit-tags.php?taxonomy=category


Since 2.6.0 Introduced.

Code of admin_url() WP 5.8.1

function admin_url( $path = '', $scheme = 'admin' ) {
	return get_admin_url( null, $path, $scheme );

Link (URL)

Site Options (settings)

Links (URL)

vladlu 100vlad.lu
Editors: Kama 101
No comments
    Log In