Fix for ‘Smells-Like-Facebook’ theme error
After upgrading my WordPress and installing the new theme, “Smells Like Facebook” the first problem I ran into was errors anytime someone posted a comment:
Warning: Cannot modify header information - headers already sent by (output started at /home/mysite/public_html/wp-content/themes/smells-like-facebook/functions.php:12) in /home/mysite/public_html/wp-comments-post.php on line 82
Warning: Cannot modify header information - headers already sent by (output started at /home/mysite/public_html/wp-content/themes/smells-like-facebook/functions.php:12) in /home/mysite/public_html/wp-comments-post.php on line 83
Warning: Cannot modify header information - headers already sent by (output started at /home/mysite/public_html/wp-content/themes/smells-like-facebook/functions.php:12) in /home/mysite/public_html/wp-comments-post.php on line 84
Warning: Cannot modify header information - headers already sent by (output started at /home/mysite/public_html/wp-content/themes/smells-like-facebook/functions.php:12) in /home/mysite/public_html/success/wp-includes/pluggable.php on line 865
Seems that I’m not the only one having this problem, and the theme author appears to be busy, so I took it as a personal challenge to fix the damn thing myself. It only took 2 or 3 hours, but I think I got it. I’m posting it here for other people getting these annoying “Cannot modify header information – headers already sent” errors with the Smells Like Facebook theme.
WARNING:: I am not a coder. I do not know what I am doing. Before you attempt the changes below, back up your files, your Wordpress database, your email and all your iTunes music! If you find that this ‘fix’ of mine breaks something else, please post a comment here. I’ve been testing this fix for a few hours and as far as I can tell, it’s working – but I make no guarantees.
As indicated in the error message, the problem is in the functions.php file, at or about line 12, which reads:
add_filter('comment_text', 'slf_comment_text', 29);
function slf_comment_text($comment) {
echo str_replace("<br>", "<br/>", nl2br($comment));
}
The fix is to change that section to read:
add_filter('comment_text', 'slf_comment_text', 29);
function slf_comment_text($comment) {
if(empty($_POST['comment_post_ID'])) {
echo str_replace("<br>", "<br/>", nl2br($comment));
}
}
Like I posted above – this has worked for me so far. If you find any problems please post them.
Applies to “Smells Like Facebook” Version 2.4






I am not able to find that text i the source for functions.php. (accessed via the admin screen, Appearance > Editor)
But it appears the comment did post successfully, here. Yours to me was flagged by askimet as spam for some reason.
huh? that’s weird. I just re-downloaded the theme (ver 2.4) and confirmed it’s right there at line #12; something is fubar over there..
Damn I shouldnt do this while talking Ambien. I kept commenting on the authors site.
Oh I was on 2.3. There hasn’t even been an announcement about 2.4, what the heck? Anyhow, I made the upgrade and then placed your hack into mine. This is your final test from me. Once more in return?
Thank you..
I’ll fix it in the next update..
Thanks for this!
Wew, Nazieb terkenal sampai disinih
wow, that’s quite a coding. Can you translate that to HTML which i understand
The coding looks quite complicated, but i love the theme! It looks just like a Facebook page.
wow thanks…iv been looking for this the who day
Hi, Randy. It looks like your code is working.
Congrats.
Thanks for the solutions.
May I ask U something?
how to make “Like” and “share this” as your theme?
Thx alot
The “Like” and “share this” are both Wordpress Plugins.. Just search the Wordpress Plugin repository and you’ll find several to choose from.
hey randy i would just like say that its a very great template,,, i would just like to ask if theres a blogger template like this…. thanks
Hi thanku, i solved my problem with your solution.
It did it… Thanx, it work!!! Case closed! ^_^
it works like a charm…thank u man….
but something weird happen on my blog…when someone put a comment after they press submit, it goes to a blank screen and on the address bar it shows like this my original wordpress url.
I use different address between my wordpress folder and my blog apperance.
Can you tell whats wrong with it?
…It is SAFE MODE ON issue, if you have SAFE MODE turned OFF, then this error doesn’t manifest itself…
Thanks for working patch!