'ids' ) ); foreach ( $sites as $site_id ) { switch_to_blog( $site_id ); robotstxt_smtp_newsletter_drop_tables(); restore_current_blog(); } } else { robotstxt_smtp_newsletter_drop_tables(); } // Delete plugin options. delete_option( 'robotstxt_smtp_newsletter_options' ); /** * Drop queue and statistics tables. * * @return void */ function robotstxt_smtp_newsletter_drop_tables() { global $wpdb; $queue_table = $wpdb->prefix . 'robotstxt_smtp_newsletter_queue'; $stats_table = $wpdb->prefix . 'robotstxt_smtp_newsletter_stats'; // Drop both tables. // phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.DirectDatabaseQuery.SchemaChange,WordPress.DB.PreparedSQL.InterpolatedNotPrepared $wpdb->query( "DROP TABLE IF EXISTS {$queue_table}" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.DirectDatabaseQuery.SchemaChange,WordPress.DB.PreparedSQL.InterpolatedNotPrepared $wpdb->query( "DROP TABLE IF EXISTS {$stats_table}" ); // Delete version options. delete_option( 'robotstxt_smtp_newsletter_queue_db_version' ); delete_option( 'robotstxt_smtp_newsletter_stats_db_version' ); }