`). * * Runs only when the plugin is deleted from the Plugins screen, not on * deactivation. On multisite, each site of the network is cleaned. * * @package Revys */ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { exit; } /** * Delete the Revys options of the current site. * * @return void */ function revys_uninstall_site() { global $wpdb; delete_option( 'revys_secret' ); delete_option( 'revys_secret_saved_at' ); delete_option( 'revys_last_sync' ); // One option per synced widget: their names are not tracked elsewhere. // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- One-off lookup at uninstall time. $names = $wpdb->get_col( $wpdb->prepare( "SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE %s", $wpdb->esc_like( 'revys_data_' ) . '%' ) ); foreach ( (array) $names as $name ) { delete_option( $name ); } } if ( is_multisite() ) { $revys_site_ids = get_sites( array( 'fields' => 'ids', 'number' => 0, ) ); foreach ( $revys_site_ids as $revys_site_id ) { switch_to_blog( (int) $revys_site_id ); revys_uninstall_site(); restore_current_blog(); } } else { revys_uninstall_site(); }