Except for the $blog_id parameter (which is only allowed in the get_admin_url function), what is the difference between admin_url and get_admin_url?


The admin_url() function retrieves the URL to the admin area for your current site. You needn't give the blog id for your current site. You can use this function if you aren't running WordPress multisite. And use the get_admin_url() function to get a specific site URL in the multisite admin.


Technically, except the $blog_id parameter, there isn't any difference at all.

admin_url function uses get_admin_url function internally with $blog_id parameter set to null. This is the CODE of admin_url function:

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

Now, check the function signature of get_admin_url:

function get_admin_url( $blog_id = null, $path = '', $scheme = 'admin' )

So basically, calling admin_url() is the same as calling get_admin_url() unless you are in a multisite installation.

So, the only realistic difference is that, admin_url() doesn't support the $blog_id parameter, so it's always used to get the admin url of the default blog (i.e. the current site you are accessing). That's why you'll need get_admin_url( $blog_id ) in a multisite installation (to get another site's admin URL within the same multisite network).


As clarified in the old WP references (but not in the new ones), the only difference between the two functions is that get_admin_url allows the management of multi-site, thanks to the $blog_id parameter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.