From ac87b8701f5c97afe59ac559479436d9a03035ac Mon Sep 17 00:00:00 2001 From: spacedmonkey Date: Wed, 17 May 2023 09:42:02 +0000 Subject: [PATCH] Networks and Sites: Load `WP_Metadata_Lazyloader` class file if class does not exist. Follow on from [55747]. As `get_sites` can be called very early in the bootstrap process, like in the sunrise.php file, it means that the `WP_Metadata_Lazyloader` may not have been loaded yet in the wp-settings.php file. Add a simple check to see if the class exists and if it does not exist then load the class file in. Props spacedmonkey, peterwilsoncc, dd32. See #58185. git-svn-id: https://develop.svn.wordpress.org/trunk@55818 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/meta.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/wp-includes/meta.php b/src/wp-includes/meta.php index 6b361aaa5e..921c24c383 100644 --- a/src/wp-includes/meta.php +++ b/src/wp-includes/meta.php @@ -1214,6 +1214,9 @@ function wp_metadata_lazyloader() { static $wp_metadata_lazyloader; if ( null === $wp_metadata_lazyloader ) { + if ( ! class_exists( 'WP_Metadata_Lazyloader' ) ) { + require_once ABSPATH . WPINC . '/class-wp-metadata-lazyloader.php'; + } $wp_metadata_lazyloader = new WP_Metadata_Lazyloader(); }