Yoast\WP\SEO\Actions

Indexables_Page_Action::get_sub_types()protectedYoast 1.0

Устарела с версии 20.4. Больше не поддерживается и может быть удалена. Рекомендуется заменить эту функцию на аналог.

Get public sub types that are relevant for the indexable page.

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

Возвращает

Массив. The subtypes.

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

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

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

Устарела с 20.4

Код Indexables_Page_Action::get_sub_types() Yoast 22.4

protected function get_sub_types() {
	$object_sub_types = \array_values( $this->post_type_helper->get_public_post_types() );

	$excluded_post_types = \apply_filters( 'wpseo_indexable_excluded_post_types', [ 'attachment' ] );

	/**
	 * Filter: 'wpseo_indexable_included_post_types' - Allow developers to specify which post types will
	 * be shown in the indexables overview cards.
	 *
	 * @param array $included_post_types The currently included post types.
	 */
	$included_post_types = \apply_filters_deprecated( 'wpseo_indexable_included_post_types', [ [ 'post', 'page' ] ], 'Yoast SEO 20.4' );
	$object_sub_types    = \array_diff( $object_sub_types, $excluded_post_types );
	$only_post_pages     = \array_intersect( $object_sub_types, $included_post_types );

	$wanted_sub_types = [];
	foreach ( $only_post_pages as $sub_type ) {
		if ( $this->post_type_helper->has_metabox( $sub_type ) ) {
			$wanted_sub_types[] = $sub_type;
		}
	}
	return $wanted_sub_types;
}