0

I have a plugin that sends binary content inside a do_parse_request filter and I need to set the proper Content-Type header but when I do it I got an error saying that Headers was already sent.

How can I prevent wordpress from sending headers until my plugin have done it's work?

1
  • WordPress doesn't send its headers that early, you probably have something else unintentionally sending output to the browser. Check for spaces before php tags or anything else that might be generating output.
    – Milo
    Commented Apr 26, 2018 at 3:10

1 Answer 1

0

Call the do_parse_request in the plugins_loaded action hook.

add_action('plugins_loaded', setup_parse_request' );

function setup_parse_request() {
    // handle parse request
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.