WordPress.org

Ready to get started?Download WordPress

Forums

Best Way to Avoid Headers Not Sent (2 posts)

  1. plumwd
    Member
    Posted 2 years ago #

    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.

    [92 lines of code moderated as per the Forum Rules. Please use the pastebin]

  2. plumwd
    Member
    Posted 2 years ago #

    Adding the pastebin.

    Just wanted to add that I did some more digging last night and am definitely getting the error within this file.Checking for headers already sent, which of course I know they are by admin-header.php.

    Basically I need to know how to have WP evaluate my code first.

    Thanks!

    Code

Topic Closed

This topic has been closed to new replies.

About this Topic