WP SEO vs Autoptimize; who broke your WordPress?

Autoptimize 1.9 was released yesterday but unfortunately some reports were coming in about JS optimization being broken.  At first I suspected the problem being related to small changes that added semi-colons to individual blocks of script (before being aggregated), but tests with some impacted users showed this was not the case.

The breakthrough came in this thread in Autoptimize’s support forum, where user “grief-of-these-days” confirmed the problem started with the update of WP SEO and specifically the “sitelinks search box“-functionality that was added in WP SEO 1.6. Sitelinks Search Box comes as an inline script of type “application/ld+json”, that contains a name-less JSON-object with “linked data”. Autoptimize detected, aggregated and minimized this name-less object, but that not only defies the sitelinks search box mechanism, but potentially also broke the optimized JS itself. So I updated & enabled WP SEO, confirmed the problem, identified “potentialAction” as unique string to base exclusion on and pushed out 1.9.1 which will now no longer Autoptimize Sitelinks Search Box-code.

So who broke your WordPress today, WP SEO or Autoptmize? Well, WP SEO’s update may have made the bug appear, but based on the fact that json-ld is standardized and as such will probably be also present in other guises, Autoptimize should really just exclude any script of the “application/ld+json”-type from being aggregated & minimized (and not just that of the Sitelinks Search Box). Adding to the to-do-list now!

14 thoughts on “WP SEO vs Autoptimize; who broke your WordPress?

  1. F.

    This might be the reason why JS optimization has a tendency to break a myriad of other JS-based functionality too, although nothing’s broken my entire WP yet. *knock on wood* So far my solution has been to turn off JS optimization if excluding files doesn’t seem to work but maybe eventually, once this issue is solved, I might not need to do that! Keep up the good work. ^_^

    Reply
    1. frank Post author

      JS optimization can indeed be tricky and there’s no silver bullet I’m afraid. Testing, excluding and continuous follow-up (esp. after plugin updates) are needed. But maybe some knocking on wood can help as well, indeed? ;-)

      Reply
  2. Max Leighton

    Hey Frank, thanks for your plugin, I am using it on my site. It reduced time to render my home page by 3 seconds!?! I am also using WP SEO Yoast. I have created a child theme of WP twenty twelve (very basic), just a few tweaks. Then I noticed that, when I use the child theme (not the original twenty twelve), and when I am logged in (not when I am logged out), and then look at one of the sub-pages (not the home page), I get no CSS rendering for the page.

    Then I disabled css optimizations checkbox inside autoptimize and the CSS rendered just fine, and everything was swell.

    Just thought this might help. And if you respond, I might learn something.

    Reply
    1. frank Post author

      Did you check if there was a reference to an autoptimized CSS-file in the HTML Max? And if so, did it exists (i.e. no 404 error)? And if so, was the content consistent with what is parent & child theme’s CSS? Any errors in the browser console?

      frank

      Reply
      1. Max Leighton

        Yes, when I check the box to optimize css, I see reference to autooptimize css http://soundblackout.com/wp-content/cache/autoptimize/css/autoptimize_422cf788205a4d4f3f98c1483b2519ca.css

        No 404. No errors in the browser that I can see.

        I have turned off [ ] autooptimize css now because the site still shows background red all over and looks like no css. I am no expert and I can not answer if the content of the autooptimize css is consistent with the twentytwelve-child theme, may be you can look now that css autooptimize is off – http://soundblackout.com

        Thanks again!

      2. frank Post author

        Hi Max;
        You’ll have to exclude the hotspots CSS, adding e.g. “hotspots/php/controllers” to the comma-seperated CSS exclusion-list.

        Hope this helps,
        frank

  3. Chris Bunting

    All In One SEO Pack + Autoptimize + Quick Cache is the best and fastest combination that I’ve tried. If you have a VPS or root access to install other software, you can use Ubuntu Tuned or RHEL Tuned on Throuput Performance.. My test site outruns just about every cache system I’ve tested, and even beats the $39.00 WP-Rocket Plug-in.. Tutorial and all details are on my test site, http://mywpdev.com

    Reply
  4. Joshua L. R.

    You know, I’ve never heard of Autoptimize…I’m going to have to check your plugin out! I definitely like the fact that you pay attention to issues and post about fixing them…off to check it out now!

    Reply
  5. danny

    Hi Frank,

    Great work on the plugin. Use it on all my sites. Is there any way to enable the minification, or at least the file combining on the wp-admin area?
    Cheers!

    Danny

    Reply
      1. Danny

        Even combining the files? Combining the css files should be pretty harmless I guess. Saves a lot of http requests in my current case.
        Just a thought!
        Groeten,

        Danny

      2. frank Post author

        Well, the big advantage of not doing the backend is that no matter what a user does in the autoptimize config, it simply cannot brake the wp-admin area. If AO were to act on that as well, some people would simply lock themselves out, and that would be hell to support ;-)

        frank

      3. Danny

        I understand your concerns :)
        Still, I’d be willing pay for it (paid plugin style).

        You could hide it under an “Unsupported Expert Settings – may destroy your site” button which you hide under Advanced settings haha

Leave a Reply

Your email address will not be published. Required fields are marked *