WPSEO_Sitemaps::get_post_statuses
Get post statuses for post_type or the root sitemap.
Метод класса: WPSEO_Sitemaps{}
Хуки из метода
Возвращает
Массив. List of post statuses.
Использование
$result = WPSEO_Sitemaps::get_post_statuses( $type );
- $type(строка)
- Provide a type for a post_type sitemap, SITEMAP_INDEX_TYPE for the root sitemap.
По умолчанию:self::SITEMAP_INDEX_TYPE
Список изменений
| С версии 10.2 | Введена. |
Код WPSEO_Sitemaps::get_post_statuses() WPSEO Sitemaps::get post statuses Yoast 27.4
public static function get_post_statuses( $type = self::SITEMAP_INDEX_TYPE ) {
/**
* Filter post status list for sitemap query for the post type.
*
* @param array $post_statuses Post status list, defaults to array( 'publish' ).
* @param string $type Post type or SITEMAP_INDEX_TYPE.
*/
$post_statuses = apply_filters( 'wpseo_sitemap_post_statuses', [ 'publish' ], $type );
if ( ! is_array( $post_statuses ) || empty( $post_statuses ) ) {
$post_statuses = [ 'publish' ];
}
if ( ( $type === self::SITEMAP_INDEX_TYPE || $type === 'attachment' )
&& ! in_array( 'inherit', $post_statuses, true )
) {
$post_statuses[] = 'inherit';
}
return $post_statuses;
}