- Timestamp:
- 06/10/2022 03:45:45 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/search/class-wp-rest-post-search-handler.php
r49955 r53485 59 59 60 60 $query_args = array( 61 'post_type' => $post_types, 62 'post_status' => 'publish', 63 'paged' => (int) $request['page'], 64 'posts_per_page' => (int) $request['per_page'], 65 'ignore_sticky_posts' => true, 66 'fields' => 'ids', 61 'post_type' => $post_types, 62 'post_status' => 'publish', 63 'paged' => (int) $request['page'], 64 'posts_per_page' => (int) $request['per_page'], 65 'ignore_sticky_posts' => true, 67 66 ); 68 67 … … 84 83 85 84 $query = new WP_Query(); 86 $found_ids = $query->query( $query_args ); 85 $posts = $query->query( $query_args ); 86 // Querying the whole post object will warm the object cache, avoiding an extra query per result. 87 $found_ids = wp_list_pluck( $posts, 'ID' ); 87 88 $total = $query->found_posts; 88 89
Note: See TracChangeset
for help on using the changeset viewer.