I'm currently working on a plugin for WordPress. In the plugin I have a mysql query that I would like for the user to be able to export the results as csv.
What is the best way to handle this and avoid "headers already sent" warnings?
Currently I submit the export form to my plugin page, check to see if it was submitted and then send the headers, but it is giving me the headers already sent warning.
"Cannot modify header information - headers already sent by (output started at /wp-admin/admin-header.php:29) in wp-content/plugins/bart/birts_dashboard.php on line 20" (this is where I first call the header).
I have done all the logical checks for extra whitespace and am not finding any. I have tried other csv export plugins and they work, so it's definitely an error within my code.