Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WordPress theme - headers already sent #15

Closed
jancbeck opened this issue Mar 20, 2012 · 7 comments
Closed

WordPress theme - headers already sent #15

jancbeck opened this issue Mar 20, 2012 · 7 comments

Comments

@jancbeck
Copy link

Using chromePHP inside a WordPress theme gives me an error of "headers already sent". The problematic line is 385:

header(self::HEADER_NAME . ': ' . $this->_encode($data));

Using ChromePHP in WP is no problem as long as wp_head() isn't called.
Is there a known workaround?

@ccampbell
Copy link
Owner

This is not a bug in my extension. You cannot send headers after output has started.

You can use headers_sent() to determine if headers have already been sent.

You can also use output buffering to delay output so you can still set headers.
http://php.net/manual/en/book.outcontrol.php

@blowsie
Copy link

blowsie commented Dec 19, 2012

I think it would be great if there could be some clear instructions on how to use this with wordpress

@StijnDeWitt
Copy link

Use the WP Chrome Logger WordPress plugin. It solves the mentioned problems.

@bueltge
Copy link

bueltge commented Feb 18, 2014

You can also use the plugin Debug Objects in WordPress. This use Chrome Logger and have also another debugging features.

@EvanHerman
Copy link

I have been using this on multiple WordPress projects with no issues. There is no issue related to the debugger and WordPress. It's all a matter of how you are using the debugger and logging your information.

@StijnDeWitt
Copy link

If you try to debug a statement at a point where the HTML output has already begun you will get the error mentioned. If output buffering is enabled you will not have a problem.

"There is no issue related to the debugger and WordPress."

I don't think it's a WordPress issue per se, but a generic PHP issue. As soon as the first HTML has been sent to the client you cannot add more debug statements. WordPress just makes it very easy to do this as you generally write plugins / themes which hook into the main site.

I wonder what setup you are using that you never had any issues? Do you use ob_start() / ob_flush() ? Some setting in Apache?

The very first debug statement I wrote gave me this error right away... Could be a coincidence...

@vaskort
Copy link

vaskort commented Nov 17, 2016

@StijnDeWitt WP Chrome Logger didn't solve the problems for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants