File tree Expand file tree Collapse file tree 1 file changed +16
-13
lines changed
Expand file tree Collapse file tree 1 file changed +16
-13
lines changed Original file line number Diff line number Diff line change @@ -3743,20 +3743,23 @@ public function the_post() {
37433743 // Full post objects queried.
37443744 $ post_objects = $ this ->posts ;
37453745 } else {
3746- // Only partial objects queried, need to prime the cache for the loop.
3747- $ post_ids = array_reduce (
3748- $ this ->posts ,
3749- function ( $ carry , $ post ) {
3750- if ( 'ids ' === $ this ->query_vars ['fields ' ] ) {
3751- $ carry [] = $ post ;
3752- } elseif ( isset ( $ post ->ID ) ) {
3753- $ carry [] = $ post ->ID ;
3754- }
3746+ if ( 'ids ' === $ this ->query_vars ['fields ' ] ) {
3747+ // Post IDs queried.
3748+ $ post_ids = $ this ->posts ;
3749+ } else {
3750+ // Only partial objects queried, need to prime the cache for the loop.
3751+ $ post_ids = array_reduce (
3752+ $ this ->posts ,
3753+ function ( $ carry , $ post ) {
3754+ if ( isset ( $ post ->ID ) ) {
3755+ $ carry [] = $ post ->ID ;
3756+ }
37553757
3756- return $ carry ;
3757- },
3758- array ()
3759- );
3758+ return $ carry ;
3759+ },
3760+ array ()
3761+ );
3762+ }
37603763 _prime_post_caches ( $ post_ids , $ this ->query_vars ['update_post_term_cache ' ], $ this ->query_vars ['update_post_meta_cache ' ] );
37613764 $ post_objects = array_map ( 'get_post ' , $ post_ids );
37623765 }
You can’t perform that action at this time.
0 commit comments