wpseo_sitemap_post_statuses
Filter post status list for sitemap query for the post type.
Использование
add_filter( 'wpseo_sitemap_post_statuses', 'wp_kama_wpseo_sitemap_post_statuses_filter', 10, 2 ); /** * Function for `wpseo_sitemap_post_statuses` filter-hook. * * @param array $post_statuses Post status list. * @param string $type Post type or SITEMAP_INDEX_TYPE. * * @return array */ function wp_kama_wpseo_sitemap_post_statuses_filter( $post_statuses, $type ){ // filter... return $post_statuses; }
- $post_statuses(массив)
- Post status list.
По умолчанию: array( 'publish' ) - $type(строка)
- Post type or SITEMAP_INDEX_TYPE.
Где вызывается хук
wpseo_sitemap_post_statuses
yoast/inc/sitemaps/class-sitemaps.php 627
$post_statuses = apply_filters( 'wpseo_sitemap_post_statuses', [ 'publish' ], $type );