функция
since MU (3.0.0)
maybe_redirect_404()
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
maybe_redirect_404()
Описание
Исправляет перенаправления 404, когда определена константа NOBLOGREDIRECT.
Исходный код
wp-includes/ms-functions.php:2189
function maybe_redirect_404() {
if ( is_main_site() && is_404() && defined( 'NOBLOGREDIRECT' ) ) {
/**
* Filters the redirect URL for s 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;
}
}
}
История изменений
| Версия | Описание |
|---|---|
| MU (3.0.0) | Introduced. |

