prefix . 'aicmp_stats'; // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange -- removing the plugin's own custom table on uninstall (expected cleanup) $wpdb->query($wpdb->prepare("DROP TABLE IF EXISTS %i", $aicmp_table)); // The promo feedback table holds what people typed about themselves, so it goes // with everything else when the plugin is removed. $aicmp_fb = $wpdb->prefix . 'aicmp_feedback'; // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange -- removing the plugin's own custom table on uninstall (expected cleanup) $wpdb->query($wpdb->prepare("DROP TABLE IF EXISTS %i", $aicmp_fb)); $aicmp_types = ['aicmp_track', 'aicmp_playlist']; foreach ($aicmp_types as $type) { $posts = get_posts(['post_type'=>$type,'numberposts'=>-1,'post_status'=>'any','fields'=>'ids']); foreach ($posts as $id) wp_delete_post($id, true); }