WPSEO_Post_Type_Sitemap_Provider::is_valid_post_type()publicYoast 1.0

Check if post type should be present in sitemaps.

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

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

Возвращает

true|false.

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

$WPSEO_Post_Type_Sitemap_Provider = new WPSEO_Post_Type_Sitemap_Provider();
$WPSEO_Post_Type_Sitemap_Provider->is_valid_post_type( $post_type );
$post_type(строка) (обязательный)
Post type string to check for.

Код WPSEO_Post_Type_Sitemap_Provider::is_valid_post_type() Yoast 22.4

public function is_valid_post_type( $post_type ) {
	if ( ! WPSEO_Post_Type::is_post_type_accessible( $post_type ) || ! WPSEO_Post_Type::is_post_type_indexable( $post_type ) ) {
		return false;
	}

	/**
	 * Filter decision if post type is excluded from the XML sitemap.
	 *
	 * @param bool   $exclude   Default false.
	 * @param string $post_type Post type name.
	 */
	if ( apply_filters( 'wpseo_sitemap_exclude_post_type', false, $post_type ) ) {
		return false;
	}

	return true;
}