mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-13 05:10:18 +00:00
Prime users cache in WP_Query and post REST API controller.
For a call to `WP_Query` or a post REST API request that contains posts from multiple authors, call the `cache_users` function, to ensure that all user data for post authors is primed in a single database query. This results in far fewer database queries on multiple author sites. Props spacedmonkey, timothyblynjacobs, peterwilsoncc. Fixes #55716. git-svn-id: https://develop.svn.wordpress.org/trunk@53482 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -369,6 +369,8 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
|
||||
|
||||
$posts = array();
|
||||
|
||||
update_post_author_caches( $query_result );
|
||||
|
||||
foreach ( $query_result as $post ) {
|
||||
if ( ! $this->check_read_permission( $post ) ) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user