Filter hook 'admin_url'

in WP Core File wp-includes/link-template.php at line 3599

View Source

admin_url

Filter Hook
Description
Filters the admin area URL.

Hook Information

File Location wp-includes/link-template.php View on GitHub
Hook Type Filter
Line Number 3599

Hook Parameters

Type Name Description
string $url The complete admin area URL including scheme and path.
string $path Path relative to the admin area URL. Blank string if no path is specified.
int|null $blog_id Site ID, or null for the current site.
string|null $scheme The scheme to use. Accepts 'http', 'https', 'admin', or null. Default 'admin', which obeys force_ssl_admin() and is_ssl().

Usage Examples

Basic Usage
<?php
// Hook into admin_url
add_filter('admin_url', 'my_custom_filter', 10, 4);

function my_custom_filter($url, $path, $blog_id, $scheme) {
    // Your custom filtering logic here
    return $url;
}

Source Code Context

wp-includes/link-template.php:3599 - How this hook is used in WordPress core
<?php
3594  	 * @param string      $path    Path relative to the admin area URL. Blank string if no path is specified.
3595  	 * @param int|null    $blog_id Site ID, or null for the current site.
3596  	 * @param string|null $scheme  The scheme to use. Accepts 'http', 'https',
3597  	 *                             'admin', or null. Default 'admin', which obeys force_ssl_admin() and is_ssl().
3598  	 */
3599  	return apply_filters( 'admin_url', $url, $path, $blog_id, $scheme );
3600  }
3601  
3602  /**
3603   * Retrieves the URL to the includes directory.
3604   *

PHP Documentation

<?php
/**
	 * Filters the admin area URL.
	 *
	 * @since 2.8.0
	 * @since 5.8.0 The `$scheme` parameter was added.
	 *
	 * @param string      $url     The complete admin area URL including scheme and path.
	 * @param string      $path    Path relative to the admin area URL. Blank string if no path is specified.
	 * @param int|null    $blog_id Site ID, or null for the current site.
	 * @param string|null $scheme  The scheme to use. Accepts 'http', 'https',
	 *                             'admin', or null. Default 'admin', which obeys force_ssl_admin() and is_ssl().
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 4
  • File: wp-includes/link-template.php
Related Hooks

Related hooks will be displayed here in future updates.