WPSEO_Admin_Pages::initpublicYoast 1.0

Make sure the needed scripts are loaded for admin pages.

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

Хуков нет.

Возвращает

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

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

$WPSEO_Admin_Pages = new WPSEO_Admin_Pages();
$WPSEO_Admin_Pages->init();

Код WPSEO_Admin_Pages::init() Yoast 25.4

public function init() {
	// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
	$page = isset( $_GET['page'] ) && is_string( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';

	// Don't load the scripts for the following pages.
	$page_exceptions    = in_array( $page, [ Settings_Integration::PAGE, Academy_Integration::PAGE, Support_Integration::PAGE ], true );
	$new_dashboard_page = ( $page === General_Page_Integration::PAGE && ! is_network_admin() );
	if ( $page_exceptions || $new_dashboard_page ) {
		// Bail, this is managed in the applicable integration.
		return;
	}
	add_action( 'admin_enqueue_scripts', [ $this, 'config_page_scripts' ] );
	add_action( 'admin_enqueue_scripts', [ $this, 'config_page_styles' ] );
}