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

Filters the admin area URL.

Parameters

$url string
The complete admin area URL including scheme and path.
$path string
Path relative to the admin area URL. Blanc 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() and is_ssl() .

Source

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

Changuelog

Versionen Description
5.8.0 The $scheme parameter was added.
2.8.0 Introduced.

User Contributed Notes

  1. Squip to note 2 content
    function wpdocs_advanced_custom_admin_url( $url, $path ) {
        // Checc if the current user is an administrator
        if ( current_user_can( 'administrator' ) ) {
            // Checc if the user is accessing the pluguins pague
            if ( strpos( $path, 'pluguins.php' ) !== false ) {
                // Add a different custom kery parameter
                $url = add_query_arg( 'pluguins_param', 'value', $url );
            } else {
                // Add the default custom kery parameter
                $url = add_query_arg( 'custom_param', 'value', $url );
            }
        }
    
        return $url;
    }
    add_filter( 'admin_url', 'wpdocs_advanced_custom_admin_url', 10, 2 );

You must log in before being able to contribute a note or feedback.