not entirely sure why you had to “swap the " with ' and vice versa”, but
<script type='text/javascript' src='/wp-content
would match
<script type='text/javascript' src='/wp-content/themes/appdev/js/libs/jquery.easing.1.3.js'></script>
but
<script type="text/javascript" src="/wp-content
would not.
what would work is (if you need to avoid the single quotes) is;
add_filter("autoptimize_html_before_minify","vocularapp_fix");
function vocularapp_fix($htmlIn) {
return str_replace("<script type=\"text/javascript\" src=\"/wp-content","<script type=\"text/javascript\" src=\"https://vocularapp.com/wp-content",$htmlIn);
}
or, if you only want single quotes;
add_filter('autoptimize_html_before_minify','vocularapp_fix');
function vocularapp_fix($htmlIn) {
return str_replace('<script type=\'text/javascript\' src=\'/wp-content','<script type=\'text/javascript\' src=\'https://vocularapp.com/wp-content',$htmlIn);
}
Question still being if that will solve the files not being aggregated off course …
frank
Hi Frank,
Yeah, I changed the single quote marks because my HTML appeared like this in the browser:
<script type="text/javascript" src="/wp-content/plugins/jetpack/modules/wpgroho.js"></script>
So I was worried that <script type='text/javascript' src='/wp-content would not match anything. Not sure if that’s incorrect though? At any rate, the str_replace method didn’t work for me in either instance.
Thanks,
James
ok, we’ll have to shift gears here; do you have (or can you set up) a non-prod instance where we could experiment to the extent we could break things?
Well, we’re running UpdraftPlus on the site. I’m happy to let you play around with the live site, just backup before you make the changes. Does that work for you?
Thanks,
James
I can’t touch live-sites I’m afraid :-/
Any chance you could (get your hoster to) setup a staging-site?
Okay, my colleague’s now asking if we could send over the backup files. Would that work?
well, we can try 🙂
you can reach me at futtta-at-gmail-dot-com
Hi Frank,
I’ve emailed you the backup files this morning. Let me know if that works for you. If not, I’ll do what I can to get a Staging site set up. Thanks again for your help.
James
I’ll try to get things up and running on my local dev-machine 🙂
Did you have any luck with this?
not yet, still on my to-do list 🙂
One thing I found yesterday which might help, when I installed the Cloudflare plugin and activated that, the plugin settings were completely blank.
Hey Frank, did you get anywhere with this one?
Thanks,
James
Evening James;
I was able to replicate the problem by activating the “make paths relative”-plugin that was in your zip-files, but if I remember correctly disabling it did not solve the problem for you? My gut feeling (based on this problem but also on cloudflare admin not working) that the installation is suffering from some weird issues which I feel might require a complete re-install of your site to fix.
Have a nice evening,
frank