mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +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:
@@ -3434,6 +3434,9 @@ class WP_Query {
|
||||
*/
|
||||
public function the_post() {
|
||||
global $post;
|
||||
if ( ! $this->in_the_loop ) {
|
||||
update_post_author_caches( $this->posts );
|
||||
}
|
||||
$this->in_the_loop = true;
|
||||
|
||||
if ( -1 == $this->current_post ) { // Loop has just started.
|
||||
|
||||
Reference in New Issue
Block a user