Filter hook 'blog_redirect_404'

in WP Core File wp-includes/ms-functions.php at line 2200

View Source

blog_redirect_404

Filter Hook
Description
Filters the redirect URL for 404s on the main site. The filter is only evaluated if the NOBLOGREDIRECT constant is defined.

Hook Information

File Location wp-includes/ms-functions.php View on GitHub
Hook Type Filter
Line Number 2200

Hook Parameters

Type Name Description
string $no_blog_redirect The redirect URL defined in NOBLOGREDIRECT.

Usage Examples

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

function my_custom_filter($no_blog_redirect) {
    // Your custom filtering logic here
    return $no_blog_redirect;
}

Source Code Context

wp-includes/ms-functions.php:2200 - How this hook is used in WordPress core
<?php
2195  		 *
2196  		 * @since 3.0.0
2197  		 *
2198  		 * @param string $no_blog_redirect The redirect URL defined in NOBLOGREDIRECT.
2199  		 */
2200  		$destination = apply_filters( 'blog_redirect_404', NOBLOGREDIRECT );
2201  
2202  		if ( $destination ) {
2203  			if ( '%siteurl%' === $destination ) {
2204  				$destination = network_home_url();
2205  			}

PHP Documentation

<?php
/**
		 * Filters the redirect URL for 404s on the main site.
		 *
		 * The filter is only evaluated if the NOBLOGREDIRECT constant is defined.
		 *
		 * @since 3.0.0
		 *
		 * @param string $no_blog_redirect The redirect URL defined in NOBLOGREDIRECT.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/ms-functions.php
Related Hooks

Related hooks will be displayed here in future updates.