Suggestion for better performance
-
In wf-cookie-consent.php at line 68 i found
add_action('wp_footer', 'wf_cookieconsent_load', 10, 1);
wf_cookieconsent_load function print in the footer the inline javascript code for cookie bar.
The inline scripts stop the combine process of some plugin like W3 Total Cache. Eg.:
<script src="script_1.js"></script> <script src="script_2.js"></script> <script>alert('wf_cookieconsent_load');</script> <script src="script_3.js"></script> <script src="script_4.js"></script>
W3 Total Cache combine it in:
<!-- script_1.js + script_2.js --> <script src="script_min_1.js"></script> <script>alert('wf_cookieconsent_load');</script> <!-- script_3.js + script_4.js --> <script src="script_min_2.js"></script>
I would suggest to grow the priorty to hightest number, eg:
add_action('wp_footer', 'wf_cookieconsent_load', 10, 1);
with this priority the combining is good:
<!-- script_1.js + script_2.js + script_3.js + script_4.js --> <script src="script_min_1.js"></script> <script>alert('wf_cookieconsent_load');</script>
I have already found a legacy solution in function.php
if( function_exists('wf_cookieconsent_load') ){ if( remove_action('wp_footer', 'wf_cookieconsent_load', 10) ){ add_action('wp_footer', 'wf_cookieconsent_load', 100, 1); } }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Suggestion for better performance’ is closed to new replies.