Support » Plugin: Autoptimize » Conflict with WP Google Maps – cannot use with AO

  • Resolved CK MacLeod

    (@ck-macleod)


    I know that problems with the WP Google Maps plugin and Autoptimize as well as Async JS have come up before, but I have a new and every perplexing one now with two very similar sites, both with the same or similar plugins, but in one of them switching WP Google Maps on or off disables Autoptimize CSS file aggregation, while on the other aggregation remains in effect.

    The site linked above, http://staging-calldixie.duffymarketing.com/, is the one where turning on WP Google Maps turns AO off. The site where the two or three plugins (not to mention many more) are all getting along is https://bettercallarmstrong.com/ There’s a staging version of that one, too, if you decide you want to get into this further.

    There ARE errors showing in DevTools, but they do not initially appear to be relevant to this issue.

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 35 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    On what page on http://staging-calldixie.duffymarketing.com/ can I see WP Google Maps used @ck-macleod ? Or is it off now?

    I just turned it back on, and AO CSS aggregation has stopped working again.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    does adding wp-content/plugins/wp-google-maps/ to the CSS optimization exclusion list make any difference?

    No change. Cleared caches and double-checked.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    OK, it is now in a footer widget (or something similar), what happens when the map is not included on a specific page (so the plugin is active on the site, it’s just not acting on that page), is the CSS optimized in that case?

    Nope – files still un-aggregated. Not minified either.

    • This reply was modified 1 year, 2 months ago by CK MacLeod.
    Plugin Author Optimizing Matters

    (@optimizingmatters)

    OK (well, not really, but still) .. Are you using the version from https://wordpress.org/plugins/wp-google-maps/ or the pro one?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    OK, the reason is in WP Google Maps code, they deactivate AO CSS optimization;

    Nothing much I (or AO) can do about that I’m afraid.

    What’s odd is that for some reason their code is NOT disabling Autoptimize at the other site I linked.

    Also, it looks like maybe we could disable their disabling – either by hacking their plugin, reverting to an earlier version, or re-filtering the filter.

    Previous comment deleted – I re-checked a setting or two… commenting out the noptimize filter DOES restore CSS aggregation.

    • This reply was modified 1 year, 2 months ago by CK MacLeod.

    Just to follow up a bit: I commented out the filter in WPGM’s “legacy-core.php,” and Autoptimize functionality is restored, and my maps seem to be working fine, too.

    Their code comment indicates that they originally added the filter on your (Autoptimize’s) advice. I really don’t know entirely what to make of observed inconsistent results, but I get the idea that they may have overcorrected. It’s a shame you all can’t work out something, since both plugins are very useful and great timesavers compared to aggregating CSS files the hard way or constructing Google Map embeds by custom scripts, or both…

    Anyway, thanks for your guidance.

    • This reply was modified 1 year, 2 months ago by CK MacLeod.
    Plugin Author Optimizing Matters

    (@optimizingmatters)

    OK, had to dig deep in my archives but indeed the filter was added after lengthy debugging of a WPGM+AO users’ problems by Perry of WP Google Maps & me, which turned out due to PCRE crashing which killed the output buffer (likely due to a combination of the amount of map data and a not-so-powerful server).

    @perryrylance could we make disabling CSS optimization conditional (on by default) with a filter or even an advanced option?

    I made a similar suggestion in the WPGM support thread, but have not received a reply.

    I’m currently managing ten sites with an AO + WPGM combination, and there are others where I’d been planning to install it, so i will be implementing or experimenting with some kind of hack or custom implementation.

    On the error/debugging conclusions you described: I’ve never had to deal with a PCRE vs output buffer issue, and can only speculate about why it might be occurring, and what other than completely disabling one or the other plugin might be done.

    I wonder if some adjustment of server settings or precise delineation of thresholds and requirements might be possible.

    Turning WPGM v AO on and off: I also want to correct a response I gave above: Autoptimize functionality IS restored if I delete the WPGM (or its shortcode) from a given page.

    I also believe that I could create a simple adapted WPGM shortcode that would re-produce the current main WPGM function without the no-Autoptimize filter, while also loading required WPGM scripts. The advantage of this approach is that I wouldn’t have to hack WPGM files. I don’t know how durable it would be vs future WPGM changes, however.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    I wonder if some adjustment of server settings or precise delineation of thresholds and requirements might be possible.

    I wouldn’t dare to, I’ve had a look into PCRE crashed some years ago and it’s way too low-level for my limited capabilities 😉

    Guess you were bolder in your younger days, way back in 2014! So were we all.

    WPGM also happens to rely right off the top on what looks like a rather intensive regex-related call (right out of the WP Codex on get_shortcode_regex())… so not too far off from “regexing while you regex.” The function in question checks whether WPGM is active, so probably could also be removed at a site where the shortcode will be active on every page anyway. I could imagine doing so might help with a too-much-regexing issue, but that’s just conjecture on my part – which is why I’m curious about defining thresholds if possible.

    • This reply was modified 1 year, 1 month ago by CK MacLeod.
Viewing 15 replies - 1 through 15 (of 35 total)
  • The topic ‘Conflict with WP Google Maps – cannot use with AO’ is closed to new replies.