Yoast\WP\SEO\Bulk_Editor\Infrastructure\Posts
Post_Meta_Posts_Collector::get_posts
Collects a page of posts for the given query.
A single page is fetched and counted through WP_Query; the per-post edit permission is then resolved for that page so posts the user cannot edit are returned locked and without their SEO data.
Метод класса: Post_Meta_Posts_Collector{}
Хуков нет.
Возвращает
Posts_Page. The collected posts together with the totals for pagination.
Использование
$Post_Meta_Posts_Collector = new Post_Meta_Posts_Collector(); $Post_Meta_Posts_Collector->get_posts( $query ): Posts_Page;
- $query(Posts_Query) (обязательный)
- The query describing the page to collect.
Код Post_Meta_Posts_Collector::get_posts() Post Meta Posts Collector::get posts Yoast 28.3
public function get_posts( Posts_Query $query ): Posts_Page {
$wp_query = $this->run_query( $query );
$post_ids = \array_map( 'intval', $wp_query->posts );
$editability = $this->post_editability_resolver->resolve( $post_ids );
$posts_list = new Posts_List();
foreach ( $post_ids as $post_id ) {
$posts_list->add( $this->build_post( $post_id, ( $editability[ $post_id ] ?? false ) ) );
}
return new Posts_Page( $posts_list, (int) $wp_query->found_posts, $query->get_page(), $query->get_per_page() );
}