Title: admin_url
Published: April 25, 2014
Last modified: February 24, 2026

---

# apply_filters( ‘admin_url’, string $url, string $path, int|null $blog_id, string|null $scheme )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/admin_url/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/admin_url/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/admin_url/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/admin_url/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/hooks/admin_url/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/hooks/admin_url/?output_format=md#wp--skip-link--target)

Filters the admin area URL.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/admin_url/?output_format=md#parameters)󠁿

 `$url`string

The complete admin area URL including scheme and path.

`$path`string

Path relative to the admin area URL. Blank string if no path is specified.

`$blog_id`int|null

Site ID, or null for the current site.

`$scheme`string|null

The scheme to use. Accepts `'http'`, `'https'`, `'admin'`, or null. Default `'admin'`,
which obeys [force_ssl_admin()](https://developer.wordpress.org/reference/functions/force_ssl_admin/)
and [is_ssl()](https://developer.wordpress.org/reference/functions/is_ssl/) .

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/admin_url/?output_format=md#source)󠁿

    ```php
    return apply_filters( 'admin_url', $url, $path, $blog_id, $scheme );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/link-template.php#L3608)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/link-template.php#L3608-L3608)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/admin_url/?output_format=md#related)󠁿

| Used by | Description | 
| [get_admin_url()](https://developer.wordpress.org/reference/functions/get_admin_url/)`wp-includes/link-template.php` |

Retrieves the URL to the admin area for a given site.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/admin_url/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | The `$scheme` parameter was added. | 
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/hooks/admin_url/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/hooks/admin_url/?output_format=md#comment-content-7119)
 2.   [Noruzzaman](https://profiles.wordpress.org/noruzzaman/)  [  2 years ago  ](https://developer.wordpress.org/reference/hooks/admin_url/#comment-7119)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fadmin_url%2F%23comment-7119)
    Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fadmin_url%2F%23comment-7119)
 4.     ```php
        function wpdocs_advanced_custom_admin_url( $url, $path ) {
            // Check if the current user is an administrator
            if ( current_user_can( 'administrator' ) ) {
                // Check if the user is accessing the plugins page
                if ( strpos( $path, 'plugins.php' ) !== false ) {
                    // Add a different custom query parameter
                    $url = add_query_arg( 'plugins_param', 'value', $url );
                } else {
                    // Add the default custom query parameter
                    $url = add_query_arg( 'custom_param', 'value', $url );
                }
            }
    
            return $url;
        }
        add_filter( 'admin_url', 'wpdocs_advanced_custom_admin_url', 10, 2 );
        ```
    
 5.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fadmin_url%2F%3Freplytocom%3D7119%23feedback-editor-7119)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fadmin_url%2F)
before being able to contribute a note or feedback.