March 6, 2013

421 words 2 mins read

WordPress 3.5 and mod_pagespeed do NOT play well together

Screen Shot 2013-03-03 at 5.01.00 PM
WordPress 3.5 may look cool, but it has found a dozen new and clever ways in which to break itself. Last week, I figured out how to fix the “Add Media” button. This week, I discovered that I could no longer select any drop-downs in the admin screens, add tags, or click most buttons. I dug around and found the “Troubleshooting WordPress 3.5 Master List” which lead me to discover that mod_pagespeed was my most recent grief giver. Fortunately, it’s easy to fix.

Screen Shot 2013-03-03 at 5.00.07 PM
First, for those who aren’t sure if they have mod_pagespeed, it is very easy to check and see if it is turned on. Load any page on your site and view the source. Look for javascript or CSS URLs that look something like: A.widgets.css,qver=20121003.pagespeed.cf.4E_CGI1sCE.css

If none of the URLs contain the word “pagespeed” then it probably isn’t turned on. What if it is? How does one fix it?

Option #1 — a2dismod pagespeed && service apache restart

WordPress suggests that you simply disable mod_pagepseed. That’s the simple solution and that did fix my button/dropdown issues. However, that sort of sucks since mod_pagespeed has, otherwise, been serving me faithfully. This also doesn’t work if you don’t control the entire server.

I decided to look for a “better” solution. One where my speedy toys would still work. I came up with the options below.

Option #2a — Disable mod_pagespeed for /wp-admin/ via module

If you run multiple WordPress sites, or otherwise have control over the entire server, I suggest you make the changes at module level. Edit /etc/apache2/mods-available/pagespeed.conf and at the bottom (Before ) of the file add the following:

<Location /wp-admin/><br /> &nbsp;&nbsp;&nbsp;ModPagespeed Off<br /> </Location>

Now restart Apache and you should be good to go. Any /wp-admin/ on any site will have the module disabled. This is the “safe” way in my book; you only need to worry about something breaking if mod_pagespeed is updated.

Option #2b — Disable mod_pagespeed for /wp-admin/ via .htaccess

If you only run one copy of WordPress, or do not have access to the entire server, you can selectively disable this module in the .htaccess file. Edit said file for your WordPress site and add the line:

ModPagespeedDisallow */wp-admin/*

That’s it! Next time you reload the admin pages, mod_pagespeed should be turned off and the buttons work again. You may need to force refresh your browser, but otherwise this change should be instantaneous. If it doesn’t work, your hosting provider has locked you down and you need to talk with them.

Good luck!