Yoast\WP\SEO\Bulk_Editor\Infrastructure\Posts
Post_Meta_Posts_Collector::build_query_args
Builds the WP_Query arguments for the given query.
Метод класса: Post_Meta_Posts_Collector{}
Хуков нет.
Возвращает
array<string,. string|int|bool|array<string>|array<int>> The WP_Query arguments.
Использование
// private - только в коде основоного (родительского) класса $result = $this->build_query_args( $query ): array;
- $query(Posts_Query) (обязательный)
- The query describing the page to collect.
Код Post_Meta_Posts_Collector::build_query_args() Post Meta Posts Collector::build query args Yoast 28.9
private function build_query_args( Posts_Query $query ): array {
$args = [
'post_type' => $query->get_content_type(),
'post_status' => $query->get_statuses(),
// Exclude password-protected posts from bulk editing.
'has_password' => false,
'fields' => 'ids',
'posts_per_page' => $query->get_per_page(),
'paged' => $query->get_page(),
// Order by post ID so the result matches the indexable collector's ordering.
'orderby' => 'ID',
'order' => 'DESC',
'ignore_sticky_posts' => true,
// We render the title, status and Yoast meta, but never the terms, so don't prime the term cache.
'update_post_term_cache' => false,
];
if ( $query->has_author_filter() ) {
$args['author'] = $query->get_author_id();
}
if ( $query->has_include() ) {
$args['post__in'] = $query->get_include_ids();
}
return $args;
}