prefix . 'vizyt_'; $tables = [ 'custom_field_values', 'custom_fields', 'notifications_log', 'coupons', 'payments', 'booking_events', 'customer_notes', 'bookings', 'customers', 'locations', 'special_days', 'schedule_breaks', 'schedules', 'staff_services', 'staff', 'services', 'categories', ]; foreach ( $tables as $table ) { $wpdb->query( $wpdb->prepare( 'DROP TABLE IF EXISTS %i', $prefix . $table ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange -- the plugin's own tables (install, upgrade, uninstall). } } private static function removeOptions(): void { delete_option( 'vizyt_db_version' ); delete_option( 'vizyt_settings' ); delete_transient( 'vizyt_widget_placed' ); delete_option( \Vizyt\Admin\EngineNotice::OPTION ); delete_option( Migrator::ERROR_OPTION ); delete_metadata( 'user', 0, \Vizyt\Admin\EngineNotice::DISMISSED_META, '', true ); delete_metadata( 'user', 0, \Vizyt\Rest\StatsController::CHECKLIST_HIDDEN_META, '', true ); $options = array_merge( \Vizyt\Admin\Settings::all_options(), [ \Vizyt\Public\WidgetAppearance::OPTION_BRANDING ] ); foreach ( $options as $option ) { delete_option( $option ); } // The widget option is shared with Vizyt Pro; keep it while Pro is installed. if ( ! apply_filters( 'vizyt_pro_installed', file_exists( WP_PLUGIN_DIR . '/vizyt-pro/vizyt-pro.php' ) ) ) { delete_option( \Vizyt\Public\WidgetAppearance::OPTION_KEY ); } } private static function removeCapabilities(): void { foreach ( wp_roles()->roles as $role_name => $_ ) { $role = get_role( $role_name ); if ( $role ) { $role->remove_cap( 'manage_vizyt' ); } } } }