I am trying to configure W3 total cache plugin to speed up my site. The minify option is great but I am running into the following issue:
Let’s say I have a JavaScript file I am attached wp_localize script()
to and it’s called 'additions.js'
. Because W3TC minifies this JavaScript file and renames it, the wp_localize_script()
function no longer sees my 'additions.js'
file and the variables inside it don’t get shared with it.
Does anyone have a solution for this? Let me know if anything is unclear.
Leave a Reply
You must be logged in to post a comment.
W3 Total Cache has 4 locations to include the minified files. Since
wp_localize_script()
hooks intowp_head()
(unless you specify in footer in your enqueue) you can use thebefore </body>
minify location and your script will have access to the variables set. On some occasions this has failed for me so I just exclude the script from minify.