making bbPress (and WordPress) work better!

How to fix Internet Explorer 8 messing up WordPress themes

Here’s a mini-plugin (single line of code actually) that will prevent the new IE8 (aka Internet Explorer 8 ) from messing up your carefully crafted WordPress or bbPress design.

<?php if (strpos($_SERVER['HTTP_USER_AGENT'],"MSIE 8")) {
header("X-UA-Compatible: IE=7");} ?>

Make a mini-plugin out of it and activate.
(you might be able to put it into functions.php if that executes before other data is sent but I am uncertain – for the extremely lazy you could in theory put it as the very very first line of header.php in your template)

I also have it listed as a more formal plugin over here

For those that don’t want to install IE8 permanently to just test their webpages, this version will run in it’s own virtual box so it doesn’t affect the rest of your system:
http://start-o.xenocode.com/layers/ie8/8-0-0-0__2/ie8.exe
There’s no install, it just runs instantly from that one file.

58 responses

  1. Pingback: Wordpress con IE8 - URIELMANIA

  2. Pingback: Internet Explorer 8 y WordPress | Amuzigi.com

  3. Pingback: Para ir con los tiempos < Escandalera

  4. Thank you so much, this fixes the IE8 sIFR troubles on all my sites, cheers! If you’re ever in Sn Francisco the beer is on me.

    April 18, 2009 at 12:24 am

  5. Anthony

    How to make a mini plugin?
    I have try to copy-paste that code to dreamweaver blank php file and save it. Then I upload to my wordpress blog, but the php file is not detected. What should I do?
    Thank’s

    April 21, 2009 at 3:43 am

  6. Anthony you can probably just copy that line into a file called
    functions.php
    and put it into your wordpress theme folder.

    April 21, 2009 at 4:18 am

  7. Alex

    Thank you so much for this tip. I was getting upset. I just installed Explorer 8 and it was rendering my Blog in a weird way. It rendered the text and took a lot of time to display pictures or the header. After putting that code in the functions.php file, it loads as before.

    Greetings,
    Alex.

    May 29, 2009 at 10:33 pm

  8. Alex

    Is there a fix for the new FireFox?? I just noticed it render the page in a weird way too in the new 3.0.10 Firefox…

    It would be great to know what exactly is causing that problem.. something in the style css, not sure..

    it loads the page in a very weird way…

    Thanks.

    May 29, 2009 at 11:13 pm

  9. you rock, _ck_ this is great!

    June 21, 2009 at 7:15 am

  10. your solution worked perfect!! Thank you so much!

    I just finished and tested my site for IE6, IE7, Safari, and FF on Mac & PC and worked out whatever little bugs I had with IE7. Then I tested on IE8 and just about flipped when everything rendered all weird…

    I hate internet exploder… each version just keeps getting worse **sigh** – the world needs to move to Firefox or any other standards compliant browser!!

    August 26, 2009 at 1:00 am

  11. My site receives millions of hits each month and I’ve been soooo frustrated with the way it looks in IE8. I had to put this code into my header.php because I already had a function.php file. AND IT WORKED!!!! THANK YOU THANK YOU THANK YOU THANK YOU!!! If you’re ever in Vegas, email me, and I’ll get you a beer as well!! 🙂

    September 5, 2009 at 10:50 am

  12. Pingback: Turn on Chrome Frame for Internet Explorer in WordPress (and bbPress) « _ck_ says…

  13. hi,
    I tried everything but my site is not showing up, the video from youtube is floating all over the place its a issue only in IE rest the site is perfect…….please help

    moringaleaf.com

    November 4, 2009 at 2:36 pm

  14. thank you my admin.

    November 29, 2009 at 6:02 pm

  15. Your plung in works correctly!!!!! THANK YOU VERY MUCH!!!!!!! I’m so happy now!!!! :)))))))

    June 6, 2010 at 2:00 pm

  16. Many, many, many thanks

    June 29, 2010 at 6:02 am

  17. ljoe

    thx a lot! still I can’t believe:)

    July 12, 2010 at 10:42 am

  18. You just saved me from another day of searching for this fix, your the best.
    Bob

    July 23, 2010 at 4:09 pm

  19. Leonardo

    Hey!!1 this grate!!1
    Como se dice en México… esto esta muy chingon!

    bye

    November 24, 2010 at 6:18 pm

  20. molly

    i’ve used your code, and although it works, i can no longer log into wordpress anymore. is there something i can fix so that i can log into wordpress again? thanks!

    Warning: Cannot modify header information – headers already sent by (output started at /home/content/27/4917527/html/WP/wp-content/plugins/explorer-fix/internet-fix.php:9) in /home/content/27/4917527/html/WP/wp-includes/pluggable.php on line 890

    January 3, 2011 at 7:52 pm

    • That error often means you’ve simply put whitespace before the <?php
      or after the ?> (either new lines or spaces).

      Make sure you have nothing before or after the start and end of the plugin code.

      January 21, 2011 at 3:58 am

  21. Cansu

    hi molly, I receive the same error message!

    It is perfectly normal when I check the site with chrome, however with ie, it is messed up!

    January 11, 2011 at 8:15 am

  22. Just after using your code I was unable to log back in this is what happens when I try on any browser now:

    Warning: Cannot modify header information – headers already sent by (output started at /home/content/r/e/u/reubenroyce/html/wp-content/themes/mts-journey/functions.php:4) in /home/content/r/e/u/reubenroyce/html/wp-includes/pluggable.php on line 890

    How do I fix that? Please help.

    January 20, 2011 at 11:24 pm

    • That error often means you’ve simply put whitespace before the <?php or after the ?> (either spaces or new lines). Make sure you have nothing before or after the start and end.

      January 21, 2011 at 3:57 am

      • So I havie no access to the server the blog is now hosted on. How do I fix it when I can not access it or log into it?

        January 21, 2011 at 4:50 pm

    • If you cannot access your blog you should delete (or rename) the plugin via FTP access.

      Assuming it’s the plugin that caused the problem, as soon as it’s deleted, it should return to normal.

      Even if you do not have FTP access, many web hosting control panels give you simulated file access to delete or rename files via your browser.

      January 21, 2011 at 4:57 pm

  23. Dom

    Great Thanks

    January 28, 2011 at 8:27 pm

  24. Well, CK, I gotta tell you that amount of excitement that I experienced when plugin worked – it is huge. Epic. Thank you. If you ever come to Croatia, you have a bottle of wine. Thank you very much for your effort and knowledge that you share.

    March 16, 2011 at 6:36 am

  25. rlb

    Thank you! Thank you! THANK YOU! A new WordPress site I’m building (1st time WordPress user) was moving like a slug on IE8. I don’t even know enough about WP yet to get into template header. But I posted your code into the top of my “Home” page and presto, everything is just great! Shame that I couldn’t find anything on either the WordPress site or Microsoft’s — so again, Thank You Very Much!!! 🙂

    April 9, 2011 at 5:09 pm

  26. Kary

    Works great! Thanks a lot! =)

    April 13, 2011 at 1:13 pm

  27. Mike J

    Wow.

    Someone give this guy an award! 🙂

    Such a simple piece of code.. WordPress should take notice!

    April 18, 2011 at 3:20 pm

  28. {{{hug!}}} I’ve been searching for a solution to the IE8 rendering issues for days, and your code inserted into my functions.php finally worked! Kudos!

    May 1, 2011 at 12:23 am

  29. I tried by editing the style.css file, but without success.
    Thanks for the solution !

    May 6, 2011 at 3:37 am

  30. thanks !!! saved the site from the terrible woes of ie8!

    May 12, 2011 at 10:57 am

  31. Anonymous

    You are a lifesaver! I hired freelancers that even couldn’t figure this out.

    July 4, 2011 at 10:57 am

  32. Doesn’t do it for me unfortunately.
    Getting this 3 columns blog show properly in IE9 or Opera is a nightmare.
    I had the template made with Artisteer, but I have been forced to switch to a ready made one and customise it. I’d have rather used my own design. But in these 2 browsers one entire widget column simply doesn’t show. Have the same problem using sufusion (ready made popular template).
    If anyone found a solution to this I would very much appreciate a reply.

    July 6, 2011 at 5:26 pm

  33. Sten

    Hi!

    I just have problems with ie 6(what i know about). Do you have any solutions for that browser?

    July 21, 2011 at 8:25 pm

  34. I just spent something like 5 hours trying to figure this out. It was working on the front page for some reason, but no other pages. But this fixed it, and I really don’t understand why it did.
    Thanks though!!

    July 30, 2011 at 7:29 pm

  35. Pingback: Cómo reparar un tema de Wordpress en IE « +Que Bits

  36. Pingback: Wordpress Theme collaps into IE (internet explorer) « Marcelino CRM E-shop Wordpress Blog

  37. Pingback: Wordpress Theme collaps into IE8 (Internet Explorer) | Marcelino

  38. Anonymous

    Thanks,
    I use the lasy way and now it´s function well.
    http://www.balloonenergia.com.br

    September 14, 2011 at 8:49 am

  39. Anonymous

    HFS! That did it! you rock

    September 21, 2011 at 6:04 pm

  40. Your bug fix for IE Explorer worked like a charm! If there’s a Nobel prize for WP developers, you deserve it! Excellent advice!

    October 13, 2011 at 12:53 pm

  41. Hi. I’m putting the code in the fisrt line of the header but this error appears:
    Parse error: syntax error, unexpected T_IF in /home/copiativ/public_html/wp-content/themes/twentyeleven/header.php on line 1

    In the functions.php, i don’t know where to put this code, i’ve already tryed but doesn’t worked.

    what do i do?

    Tks!

    October 19, 2011 at 8:02 am

  42. gypsiandworld

    life saver

    November 5, 2011 at 5:21 pm

  43. Pls , where can i find the functions.php in my wordpress theme, am using weaver theme.. pls reply asap!!! thanks bro!!

    November 9, 2011 at 3:48 am

  44. Hi CK;
    I´m using your mini-plugin following your instructions and I can´t find the solution for prevent the changes between IE8 and wordpress.
    I would like a reply with a post or an mail.
    Thank you very much for your kindness.
    Francisco.

    December 2, 2011 at 5:21 pm

    • Keep in mind this plugin was meant for when IE8 was released to make a theme that worked with IE7 keep working with IE8

      It’s not meant to address the numerous problems in general that IE8 has rendering a theme compared to Chrome or Firefox or Safari.

      December 2, 2011 at 5:24 pm

  45. This problem is in : http://www.revistacoiffure.com/

    Thank you again.
    Francisco

    December 2, 2011 at 5:24 pm

  46. diana

    wow It’ works! thx!

    January 27, 2012 at 4:53 am

  47. Anonymous

    Very Very thanks.
    You are my masteer

    March 7, 2012 at 1:37 pm

  48. reesnews

    сбережения сватьей зарей

    May 22, 2012 at 11:38 am

  49. Emilmlix

    спица мягкой награду

    June 3, 2012 at 5:27 pm

  50. rootrody

    небосклона управлять объективного

    June 17, 2012 at 3:34 pm

  51. I ve tried to instal the portion of code inside the very first line of header.php and functions.php but it doesn not work.
    menu of my website http://www.tuscan-farmholiday.com is defently a mess with explorer 8.
    Can you help me?
    I will not offer you a bottle of win or beer but a discount for a stay in my resort!:-)
    Thanks dear.
    Otherwise just let me know if I can seriously commit this job to you to fix it.
    Thanks.

    August 1, 2012 at 6:21 am

  52. Hi,
    I have installed WPML to translate our site. I added the code and it seemed to help with the english version, but not the german (/de/). What is the best way to help this?

    Our site is http://www.thelearningeye.com – thanks. Andy

    August 28, 2012 at 4:56 am

  53. it is really work thanks a lot

    September 2, 2012 at 9:05 am