Filter hook 'home_url'

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

View Source

home_url

Filter Hook
Description
Filters the home URL.

Hook Information

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

Hook Parameters

Type Name Description
string $url The complete home URL including scheme and path.
string $path Path relative to the home URL. Blank string if no path is specified.
string|null $orig_scheme Scheme to give the home URL context. Accepts 'http', 'https', 'relative', 'rest', or null.
int|null $blog_id Site ID, or null for the current site.

Usage Examples

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

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

Source Code Context

wp-includes/link-template.php:3487 - How this hook is used in WordPress core
<?php
3482  	 * @param string      $path        Path relative to the home URL. Blank string if no path is specified.
3483  	 * @param string|null $orig_scheme Scheme to give the home URL context. Accepts 'http', 'https',
3484  	 *                                 'relative', 'rest', or null.
3485  	 * @param int|null    $blog_id     Site ID, or null for the current site.
3486  	 */
3487  	return apply_filters( 'home_url', $url, $path, $orig_scheme, $blog_id );
3488  }
3489  
3490  /**
3491   * Retrieves the URL for the current site where WordPress application files
3492   * (e.g. wp-blog-header.php or the wp-admin/ folder) are accessible.

PHP Documentation

<?php
/**
	 * Filters the home URL.
	 *
	 * @since 3.0.0
	 *
	 * @param string      $url         The complete home URL including scheme and path.
	 * @param string      $path        Path relative to the home URL. Blank string if no path is specified.
	 * @param string|null $orig_scheme Scheme to give the home URL context. Accepts 'http', 'https',
	 *                                 'relative', 'rest', or null.
	 * @param int|null    $blog_id     Site ID, or null for the current site.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 4
  • File: wp-includes/link-template.php
Related Hooks

Related hooks will be displayed here in future updates.