Yoast\WP\SEO\Helpers

Current_Page_Helper::is_block_editor │ public │ Yoast 1.0

Determines whether the current admin screen is the block editor.

Deliberately uses get_current_screen() and not WP_Screen::get(): the latter re-applies the replace_editor filter on every call, which is a render hook with side effects (e.g. it breaks the WooCommerce block email editor).

Only reliable after set_current_screen() has run (during admin page load, after admin_init); earlier calls return false.

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

Хуков нет.

Возвращает

bool. Whether the current screen is the block editor.

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

$Current_Page_Helper = new Current_Page_Helper();
$Current_Page_Helper->is_block_editor();

Код Current_Page_Helper::is_block_editor() Yoast 28.9

public function is_block_editor() {
	if ( ! \function_exists( 'get_current_screen' ) ) {
		return false;
	}

	$screen = \get_current_screen();

	return $screen !== null && $screen->is_block_editor();
}