query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'cky_banners' ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'cky_cookie_categories' ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'cky_cookies' ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery $prefix = $wpdb->esc_like( '_transient_cky' ) . '%'; $keys = $wpdb->get_results( $wpdb->prepare( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE %s", $prefix ), ARRAY_A ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery if ( ! is_wp_error( $keys ) ) { $transients = array_map( function( $key ) { return ltrim( $key['option_name'], '_transient_' ); }, $keys ); foreach ( $transients as $key ) { delete_transient( $key ); } } $options = array( 'cky_banners_table_version', 'cky_cookie_category_table_version', 'cky_cookie_table_version', 'cky_consent_table_version', 'cky_scan_details', 'cky_settings', 'cky_admin_notices', 'wt_cli_version', 'CookieLawInfo-0.9', 'cky_cookie_consent_lite_db_version', 'cky_missing_tables', 'cky_migration_options', ); foreach ( $options as $option_name ) { delete_option( $option_name ); } } catch ( Exception $e ) { error_log( __( 'Failed to delete CookieYes plugin data!', 'cookie-law-info' ) ); } }