Ankush Mehrotra
asked 10 years ago

Getting warning on submitting the answer:

 
Also I am getting comments template many times.

Kindly help.

Ankush Mehrotra
replied 10 years ago

Duplicating comments have been resolved by myself. But tell me something about the error.

Which says “Warning: Cannot modify header information – headers already sent by (output started at /home/content/48/9536248/html/wp-content/themes/dw-minion/header.php:3) in /home/content/48/9536248/html/wp-includes/pluggable.php on line 899

5 Answers
Half Assed
answered 10 years ago

Hello. I would like to say that I have this issue too. I am running multisite, but I have also tested this on a non multisite installation and it gives me the same error. It doesn’t matter what theme I use or if its with or without plugins, it does always tell me this error when I submit an answer (in this case I use twentytwelve): 
 

Warning: Cannot modify header information – headers already sent by (output started at /home/xxx/public_html/wp-content/themes/xxx/header.php:14) in/home/xxx/public_html/wp-includes/pluggable.php on line 899
 

The answer is submitted and appears on the page though, but the error always is on the top of the page when doing so. The line of code it refers to in “pluggable.php” contains this:
 

header(“Location: $location”, true, $status);
 

When I remove that line it seems like it works and give no errors at all (which I actually expected to happen).
 

The line of code it refers to in header.php is actually anything that is in the header. If I put the header in HTML instead of PHP in header.php it does actually work and doesn’t show the error.
 

I did a lot of research on this, but I still can’t find what is going on. I have been following the tutorial on WordPress.org (http://codex.wordpress.org/FAQ_Troubleshooting#How_do_I_solve_the_Headers_already_sent_warning_problem.3F) without any results. I did like everything I could find on the web regarding this issue, like re-uploading the plugin in both ASCII and the other mode via FTP, changed my database encoding etc etc.
 

Normally I don’t like to bother the plugin writer for stuff you can find out on your own, but I’m kinda out of options right now :p At first I wanted to create a new question for this but it seems someone else has the same problem as me. Hurray!
 

If there is no fix I will try to hide the error with CSS or something, since it does work and submits the answers like it normally should. But if there is a fix that would be awesome!
 

As last thing I would like to thank you for this great plugin! I’m coming from the WPMUDEV (paid) Q&A plugin, but yours is like a gazillion times better! 🙂

Ankush Mehrotra
replied 10 years ago

I dug deep, but as per my knowledge, I found myself unable to rectify this issue, so updated as a question.

Kido D
answered 10 years ago

Hi Ankush & Half Assed,
 

This warning message is commonly seen by websites using PHP. So there would be many reasons why this warning shows up. About WordPress, there are some tips for you to resolve it:
 

I had to put a closing “?>” at the end of my functions.php and made sure there weren’t any spaces or line breaks.”
 

1. Download your wp-config.php down via FTP (Edit directly if you have SSH access)
2. Open wp-config with your favourite editor, and remove all spaces before “<?php” and after “?>
3. Upload and replace.
 

I found a simple solution that worked for me. Simply take the wp-config.php file, open it in a text editor and click save as. It will try to save as UTF-8 file, save it as ANSI. As i said this worked for me…
 

The issue turned out to be that the file was a UTF-8 encoded filewith BOM signature. This was causing the file header to be transferred prior the content has been processed, and therefore I have had the cannot modify headers error.
Please check your files encoding as well as if it seems to you there is no error in your script.
 

Sources:

http://wordpress.org/support/topic/header-error-wp-includespluggablephp-on-line-876#post-3891120
http://www.hongkiat.com/blog/wordpress-error-warning-cannot-modify-header-information/
http://www.tech-recipes.com/rx/1489/solve-php-error-cannot-modify-header-information-headers-already-sent/
 
Hope that helps!

Ankush Mehrotra
replied 10 years ago

Hello Kido,
I have replaced the wp-config.php in ANSI encoding, and removed all possible white spaces within. But all in vain, still getting error.

Kido D
replied 10 years ago

Hi Ankush, please send me your WP admin by Private Question so that I can take a look on your site.

Half Assed
replied 10 years ago

Hello Kido D, thank you for your answer. Unfortunately none of the methods either work for me. I also tried to install WP in different ways (manual, manual as ANSI, via Fantastico and via Installatron), with no result. I was wondering if there is any progress regarding this problem. Thank you very much again!

Ankush Mehrotra
replied 10 years ago

Kido, I have disabled the file editing from dashboard. But will create an admin account for you to explore. I am opening a private question. have a look at it.

Kido D
answered 10 years ago

Hi guys,

Could you try to:
 
–   Deactivate all plugins (exclude DW Q&A) to see if this resolves the problem. If this works, re-activate the plugins one by one until you find the problematic plugin(s).
–   Re-upload the “wp-admin” and “wp-includes” folders from a fresh download of WordPress.
–   Switch to the default theme Twenty Twelve to see if the theme is causing the problem.
 
I would do the same to detect the issue on your sites. I can understand that you guys don’t feel comfortable providing us credential, but with admin account, I can have a better look at the issue. I can assure that your credentials will be safe with us.
 

Half Assed
replied 10 years ago

Hello Kido D, Thanks again for your reply. Unfortunately I have already done all of those steps. I even get the error on a fresh install. I could set up a new installation for you to look at though. How can I send the credentials to you?

Kido D
replied 10 years ago

Hi, you can create a new Private Question here http://cmspioneer.com/designwall/ask-question/

Half Assed
replied 10 years ago

Hello Kido D, I have posted a private question with the details. Thanks for all the help!

Anonymous
answered 10 years ago

I am also having this issue. It’s with a fresh install of WordPress using the standard-issue “TwentyTwelve” theme. I’ve tried it with other themes too, and the problem is always the same. Users can post questions with no problem whatsoever. The problem arises whenever somebody tries to answer the question. When someone answers a question, it creates the following error:
Warning: Cannot modify header information – headers already sent by (output started at /home/content/93/10068593/html/questions/wp-content/themes/twentytwelve/header.php:13) in /home/content/93/10068593/html/questions/wp-includes/pluggable.php on line 898
These are the same files mentioned by the other posters above … header.php and pluggable.php. It seems we are all having the same exact issue. It’s unfortunate, because I really want to use the plugin. It seems like a great resource for my visitors. But I can’t keep showing them an error message.
Has anyone had any luck figuring this out yet? Thanks!
 
 
 

Ankush Mehrotra
replied 10 years ago

NO dude,
I am still digging and experimenting for the same issue. But all in vain

Kido D
answered 10 years ago

Hi guys,
Sorry for taking too long!
For those who are facing this problem, please go to Dashboard / Plugins / Editor, select DW Question & Answer plugin, then click to edit dw-question-answer/inc/actions.php.

Find this code below (at the very first of the file):

<?php 
global $post_submit_filter;

and change it into this:

<?php 
error_reporting(0);
global $post_submit_filter;

Hope that helps!

Powered by DW Question & Answer Pro