WP_Recovery_Mode::redirect_protected()protectedWP 5.2.0

Redirects the current request to allow recovering multiple errors in one go.

The redirection will only happen when on a protected endpoint.

It must be ensured that this method is only called when an error actually occurred and will not occur on the next request again. Otherwise it will create a redirect loop.

Метод класса: WP_Recovery_Mode{}

Хуков нет.


null. Ничего (null).


// protected - в коде основоного (родительского) или дочернего класса
$result = $this->redirect_protected();

Список изменений

С версии 5.2.0 Введена.

Код WP_Recovery_Mode::redirect_protected() WP 6.5.3

protected function redirect_protected() {
	// Pluggable is usually loaded after plugins, so we manually include it here for redirection functionality.
	if ( ! function_exists( 'wp_safe_redirect' ) ) {
		require_once ABSPATH . WPINC . '/pluggable.php';

	$scheme = is_ssl() ? 'https://' : 'http://';

	$url = "{$scheme}{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
	wp_safe_redirect( $url );