Yoast_Network_Admin::terminate_request()publicYoast 1.0

Terminates the current request by either redirecting back or sending an AJAX response.

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

Хуков нет.

Возвращает

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

Использование

$Yoast_Network_Admin = new Yoast_Network_Admin();
$Yoast_Network_Admin->terminate_request();

Код Yoast_Network_Admin::terminate_request() Yoast 23.8

public function terminate_request() {
	if ( wp_doing_ajax() ) {
		$settings_errors = get_settings_errors();

		if ( ! empty( $settings_errors ) && $settings_errors[0]['type'] === 'updated' ) {
			wp_send_json_success( $settings_errors, 200 );
		}

		wp_send_json_error( $settings_errors, 400 );
	}

	$this->persist_settings_errors();
	$this->redirect_back( [ 'settings-updated' => 'true' ] );
}