Thursday, September 25, 2014

Fixing My Missing WordPress Comments AND "Cannot modify header information" Error

Fixing My Missing WordPress Comments AND "Cannot modify header information" Error

This piece addresses how I fixed my missing WordPress site Comments AND the remedy for the error message "Warning: Cannot modify header information - headers already sent by," under my THESIS 1.8.5 version installation.

-

All WordPress Comments Are Gone, What To Do?


I have no clue when my website comments went away, but it seemed that this problem started when WordPress updated itself to 4.0 on my website, www.brusimm.com. This update did NOT agree with my Thesis v1.8.5 installation, at all and that, was the problem. At least for me, after much deliberation and research.

So if you're a Thesis user, don't freak out and blame any one plugin, don't reinstall the update. Don't go off deactivating and reactivating every single plugin attached to your site or reinitializing plugin folders.

Nope, that was about a week's worth of my time tinkering with all that noise.  When nothing worked, I focused my attention on looking for the error, in conjunction with my installed Thesis framework, and low and behold, I found an answer.

-

NOTE: This worked with my Thesis 1.8.5 installation. I do not believe it will work for any other version.

- Using an FTP client, navigate to " /wp-content/themes/thesis_185/lib/classes/ " folder.

- Back up then edit your "comments.php" at line 187 or this exact set of lines, whereever it may occur:

The ORIGINAL looks like this:
$wp_query->comments_by_type = &separate_comments($wp_query->comments);
    $_comments = $wp_query->comments_by_type['comment'];

The NEW VERSION looks like this:

$wp_query->comments_by_type = separate_comments($wp_query->comments);
    $_comments = &$wp_query->comments_by_type['comment'];

If you look carefully, all that actually happened was that the ampersand "&" moved from "&separate_comments" to "&$wp_query->comments_by_type" in the section.

That's it... a simple move of the Ampersand.

-

After moving a single character in my Thesis 1.8.5 comments.php file to get my comments to show back up, and yes, they instantly started behaving again, another issue popped up right afterwards.

After all the bullshit of tinkering with various plugins and other files I discovered that somewhere along the way, something went afoul in my a file somewhere.

-

Now when I run a command from the admin panel, I kept getting these kinds of errors:


Warning: Cannot modify header information - headers already sent by (output started at /home2/brusimm1/public_html/wp-content/themes/thesis_185/lib/classes/comments.php:1) in /home2/brusimm1/public_html/wp-admin/post.php on line 233


And/Or

Warning: Cannot modify header information - headers already sent by (output started at /home2/brusimm1/public_html/wp-content/themes/thesis_185/lib/classes/comments.php:1) in /home2/brusimm1/public_html/wp-includes/pluggable.php on line 1173

But what I learned, after much digging, was incredibly helpful, easy and quick to fix. It seemed that an errant space or tab had inserted itself in a file and was interrupting the smooth flow of my work.

- - - -

After a ton of misleading "fixes," this is what I found two good suggestions:

In one set of instructions, I saw the recommendation to (remove all spaces before "") in the file noted in the first line.

Or to look to remove any whitespace at the line number noted.

-

The third optional set of instructions I found online (which is what I ended up doing) said to address the issue in the first file mentioned, not the latter. ALWAYS the first file.

When seeing the above mentioned error, get back to that file via your FTP client or whatever client you prefer, back it up, open it from your site, copy the entire file (no more or no less) and paste it into a BRAND NEW version of the file and save it, by the same name, to your hard drive.  Then using your FTP client, push the desktop version you just created out to your web server.

Believe it or not, this did the trick for me.

Subsequent instructions noted that this should fix the problem in that file, but if the error returns, it will have a different file located in the first line of the error message. The instructions indicated to repeat the process with the first file noted.  (Keep in mind, despite the second file being mentioned, it's a pawn or victim of this logic flaw taking place in that first file.)  The instructions noted were to continue repeating this process until the error goes away.

Where I found the instructions for this fix, there were a myriad of comments saying thanks and that this worked. In my case, it only took one file, but a few others noted it took a few files getting fixed, to rememdy their problem.

The person/user who presented this is the link accredited to CoolRunLT.

Resources On Amazon : Using Wordpress

-

Resources used:

wordpress org/ (error-after-upgrade-to-wordpress-4)

hongkiat (error-warning-cannot-modify-header-information)

wordpress org (headers-already-sent) (User: CoolRunLT)





- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Follow or subscribe to Consumer Bits on

1 comment:

Hi - sorry for the confirmation but I need to weed out the noise from the well intended comments. Thanks for leaving a note... - Bruce