函数原型
maybe_redirect_404()
函数描述
Corrects 404 redirects when NOBLOGREDIRECT is defined.
是否弃用
未弃用
函数参数
无
函数返回值
无
函数位置
File: wp-includes/ms-functions.php.
函数源码
function maybe_redirect_404() {
if ( is_main_site() && is_404() && defined( 'NOBLOGREDIRECT' ) ) {
/**
* 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.
*/
$destination = apply_filters( 'blog_redirect_404', NOBLOGREDIRECT );
if ( $destination ) {
if ( '%siteurl%' === $destination ) {
$destination = network_home_url();
}
wp_redirect( $destination );
exit;
}
}
}
源码链接
变更日志
| Version | Description |
|---|---|
| MU (3.0.0) | Introduced. |

