Yoast\WP\SEO\Actions

Indexables_Page_Action::get_sub_types()protectedYoast 1.0

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

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

Возвращает

Массив. The subtypes.

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

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

Код Indexables_Page_Action::get_sub_types() Yoast 19.10

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( 'wpseo_indexable_included_post_types', [ 'post', 'page' ] );
	$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;
}