From a2dc5462dcf016951aed028d7d4a4c9e8c759fc4 Mon Sep 17 00:00:00 2001 From: Clayton Collie Date: Fri, 17 Dec 2021 09:55:34 -0600 Subject: [PATCH] Add support for single site and multisite installs --- includes/class-simple-local-avatars.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/includes/class-simple-local-avatars.php b/includes/class-simple-local-avatars.php index 2df91b25..255247ae 100644 --- a/includes/class-simple-local-avatars.php +++ b/includes/class-simple-local-avatars.php @@ -734,7 +734,17 @@ public function migrate_from_wp_user_avatar() { global $wpdb; $count = 0; - $sites = get_sites(); + + // Support single site and multisite installs. + // Use WordPress function if running multisite. + // Create generic class if running single site. + if ( is_multisite() ) { + $sites = get_sites(); + } else { + $site = new stdClass(); + $site->blog_id = 1; + $sites = array( $site ); + } // Bail early if we don't find sites. if ( empty( $sites ) ) {