'ids', 'number' => 0, ) ); foreach ( $site_ids as $site_id ) { switch_to_blog( (int) $site_id ); self::cleanup_site(); restore_current_blog(); } } /** * Clean the current site if the owner chose to delete data. * * @return void */ private static function cleanup_site(): void { $advanced = get_option( Settings::option_name( 'advanced' ), array() ); if ( empty( $advanced['delete_data'] ) ) { return; } foreach ( Installer::CRON_HOOKS as $hook ) { wp_clear_scheduled_hook( $hook ); } $vehicle_ids = get_posts( array( 'post_type' => 'rentbaik_vehicle', 'post_status' => 'any', 'posts_per_page' => -1, 'fields' => 'ids', ) ); foreach ( $vehicle_ids as $vehicle_id ) { wp_delete_post( (int) $vehicle_id, true ); } \Rentbaik\Customers\Photos::remove_all(); Schema::drop(); Capabilities::uninstall(); foreach ( Settings::GROUPS as $group ) { delete_option( Settings::option_name( $group ) ); } delete_option( 'rentbaik_version' ); delete_option( 'rentbaik_pages' ); delete_option( 'rentbaik_installed_at' ); delete_option( 'rentbaik_setup' ); delete_option( 'rentbaik_sample_data' ); delete_option( \Rentbaik\Frontend\Guard::SECRET_OPTION ); delete_transient( 'rentbaik_setup_redirect' ); delete_transient( \Rentbaik\Admin\PrivateCheck::TRANSIENT ); } }