maybe_redirect_404
函数
maybe_redirect_404 ( No parameters )
- 定义位置
-
-
wp-includes/ms-functions.php
, line 2128
-
wp-includes/ms-functions.php
- 引入
- –
- 弃用
- –
纠正了定义NOBLOGREDIRECT时的404重定向。
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; } } }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。