Hello great community,
I was asking support same question:
“I have issues that is caused by google pagespeed. Like I describe in a ticket subject, ACF tabs is not showing in page and I get some plenty errors in Console. I was searching solution, but without any luck :-|”
“I am afraid I do not have much experience with the google pagesspeed and such issues are normally beyond the scope of our support.”
So, since support have tied hands resolving this issue, I’m asking community now…does anybody have this issue/problem before, and how he is solved it? Just to tell you, everithing was working fine until I add pagespeed module in Hosting, so no single plugin brakes ACF. I will continue investigating this issue, and hope i will came up with something.
Ok, this is some dirty solution, but its working 😀
I found it here https://modpagespeed.com/doc/restricting_urls . This is just documentation of how you Allow or Disallow certain files/folders on your project.
So what I do is just Disallow input.js from ACF plugin
pagespeed Disallow "http://yourwebsiteurl/wp-content/plugins/advanced-custom-fields/js/input.js";
And since input.js is not going tough “fingers” of pagespeed module, everything is working fine.
Just a comment for people looking for anything similar. Please not that I am not the developer of ACF or do I have first hand knowledge of the module mentioned in the OP.
The main problem with when things that combine scripts into a single file break a site is that they fail to take into account the use of localizing scripts in WP. Many plugins, including ACF rely on this localization to work.
When a script is localized WP adds something similar to this just before the line that loads the JS file
The above is a WP localization for /wp-admin/js/edit-comments.js
This localized data must appear before the effected script is included in many cases because the script depends on these values to work properly.
In other cases the combination does take this into account but it will minify this example code to a single line, which will also break the code because the CDATA tags need to be their own separate lines.
Another thing that could break sites is that a tiny error in one JS file, when minified, could cause an error that breaks all of the scripts that are included after it.
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2022 Advanced Custom Fields.