Make WordPress Core


Ignore:
Timestamp:
05/11/2023 11:13:10 AM (7 months ago)
Author:
spacedmonkey
Message:

Networks and Sites: Lazy load site meta.

In [36566] a framework to lazily load metadata was introduced. This supported term and comment meta by default. In this commit, extends support for site ( blog ) meta. Site meta is not heavily used by core and is used by developers to extend multisite. In this change, _prime_site_caches and WP_Site_Query now call the new function wp_lazyload_site_meta. The function wp_lazyload_site_meta accepts an array of ids and adds them to the queue of metadata to be lazily loaded. The function get_blogs_of_user was updated to now lazily load site meta.

Follow on from [55671].

Props spacedmonkey, johnjamesjacoby, peterwilsoncc, mukesh27.
Fixes #58185.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-site-query.php

    r55526 r55747  
    389389        $site_ids = array_map( 'intval', $site_ids );
    390390
     391        if ( $this->query_vars['update_site_meta_cache'] ) {
     392            wp_lazyload_site_meta( $site_ids );
     393        }
     394
    391395        if ( 'ids' === $this->query_vars['fields'] ) {
    392396            $this->sites = $site_ids;
     
    397401        // Prime site network caches.
    398402        if ( $this->query_vars['update_site_cache'] ) {
    399             _prime_site_caches( $site_ids, $this->query_vars['update_site_meta_cache'] );
     403            _prime_site_caches( $site_ids, false );
    400404        }
    401405
Note: See TracChangeset for help on using the changeset viewer.