'ids', 'number' => 0, ) ); foreach ( $site_ids as $site_id ) { switch_to_blog( (int) $site_id ); self::cleanup_site(); restore_current_blog(); } } /** * Cleans up the current site. * * @return void */ private static function cleanup_site(): void { $options = array( Settings::OPTION, Migration::DB_VERSION_OPTION, ...array_keys( Migration::LEGACY_OPTIONS ) ); foreach ( $options as $option ) { delete_option( $option ); } foreach ( Context::cases() as $context ) { delete_post_meta_by_key( $context->product_meta_key() ); delete_metadata( 'term', 0, $context->term_meta_key(), '', true ); } } }