maybe_redirect_404
Correct 404 redirects when NOBLOGREDIRECT is defined.
Description
maybe_redirect_404();
Usage
if ( !function_exists( 'maybe_redirect_404' ) ) { require_once ABSPATH . WPINC . '/ms-functions.php'; } // NOTICE! Understand what this does before running. $result = maybe_redirect_404();
Defined (1)
The function is defined in the following location(s).
- /wp-includes/ms-functions.php
- function maybe_redirect_404() {
- /**
- * 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.
- */
- if ( is_main_site() && is_404() && defined( 'NOBLOGREDIRECT' ) && ( $destination = apply_filters( 'blog_redirect_404', NOBLOGREDIRECT ) ) ) {
- if ( $destination == '%siteurl%' )
- $destination = network_home_url();
- wp_redirect( $destination );
- exit();
- }
- }