WP_Sitemaps_Posts::get_posts_query_args()
Returns the query args for retrieving posts to list in the sitemap.
Метод класса: WP_Sitemaps_Posts{}
Хуки из метода
Возвращает
Массив
. Array of WP_Query arguments.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_posts_query_args( $post_type );
- $post_type(строка) (обязательный)
- Post type name.
Список изменений
С версии 5.5.0 | Введена. |
С версии 6.1.0 | Added ignore_sticky_posts default parameter. |
Код WP_Sitemaps_Posts::get_posts_query_args() WP Sitemaps Posts::get posts query args WP 6.5.2
protected function get_posts_query_args( $post_type ) { /** * Filters the query arguments for post type sitemap queries. * * @see WP_Query for a full list of arguments. * * @since 5.5.0 * @since 6.1.0 Added `ignore_sticky_posts` default parameter. * * @param array $args Array of WP_Query arguments. * @param string $post_type Post type name. */ $args = apply_filters( 'wp_sitemaps_posts_query_args', array( 'orderby' => 'ID', 'order' => 'ASC', 'post_type' => $post_type, 'posts_per_page' => wp_sitemaps_get_max_urls( $this->object_type ), 'post_status' => array( 'publish' ), 'no_found_rows' => true, 'update_post_term_cache' => false, 'update_post_meta_cache' => false, 'ignore_sticky_posts' => true, // Sticky posts will still appear, but they won't be moved to the front. ), $post_type ); return $args; }