WPSEO_Post_Type_Sitemap_Provider::is_post_type_archive_indexable()protectedYoast 11.5

Determines whether a post type archive is indexable.

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

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

Возвращает

true|false. True when post type archive is indexable.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->is_post_type_archive_indexable( $post_type, $archive_page_id );
$post_type(строка) (обязательный)
Post type.
$archive_page_id(int)
The page id.
По умолчанию: -1

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

С версии 11.5 Введена.

Код WPSEO_Post_Type_Sitemap_Provider::is_post_type_archive_indexable() Yoast 22.3

protected function is_post_type_archive_indexable( $post_type, $archive_page_id = -1 ) {

	if ( WPSEO_Options::get( 'noindex-ptarchive-' . $post_type, false ) ) {
		return false;
	}

	/**
	 * Filter the page which is dedicated to this post type archive.
	 *
	 * @since 9.3
	 *
	 * @param string $archive_page_id The post_id of the page.
	 * @param string $post_type       The post type this archive is for.
	 */
	$archive_page_id = (int) apply_filters( 'wpseo_sitemap_page_for_post_type_archive', $archive_page_id, $post_type );

	if ( $archive_page_id > 0 && WPSEO_Meta::get_value( 'meta-robots-noindex', $archive_page_id ) === '1' ) {
		return false;
	}

	return true;
}