WPSEO_Admin_Init::should_load_meta_boxes()privateYoast 1.0

Whether we should load the meta box classes.

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

Хуки из метода

Возвращает

true|false. true if we should load the meta box classes, false otherwise.

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

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

Код WPSEO_Admin_Init::should_load_meta_boxes() Yoast 24.3

private function should_load_meta_boxes() {
	/**
	 * Filter: 'wpseo_always_register_metaboxes_on_admin' - Allow developers to change whether
	 * the WPSEO metaboxes are only registered on the typical pages (lean loading) or always
	 * registered when in admin.
	 *
	 * @param bool $register_metaboxes Whether to always register the metaboxes or not. Defaults to false.
	 */
	if ( apply_filters( 'wpseo_always_register_metaboxes_on_admin', false ) ) {
		return true;
	}

	// If we are in a post editor.
	if ( WPSEO_Metabox::is_post_overview( $this->pagenow ) || WPSEO_Metabox::is_post_edit( $this->pagenow ) ) {
		return true;
	}

	// If we are doing an inline save.
	if ( check_ajax_referer( 'inlineeditnonce', '_inline_edit', false ) && isset( $_POST['action'] ) && sanitize_text_field( wp_unslash( $_POST['action'] ) ) === 'inline-save' ) {
		return true;
	}

	return false;
}