• Resolved francescobagnoli

    (@francescobagnoli)


    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);
        }
    }

    https://www.ads-software.com/plugins/wf-cookie-consent/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter francescobagnoli

    (@francescobagnoli)

    errata corrige:

    I would suggest to grow the priorty to hightest number, eg:

    add_action('wp_footer', 'wf_cookieconsent_load', 100, 1);

    100 not 10

    Plugin Author wunderfarm

    (@wunderfarm)

    Hi francescobagnoli,
    thx for writing us!

    There’s a new Version out (1.0.0) wich includes the suggestions you made.
    If you need further assistance or have any any further questions or feature requests to report please do not hesitate to contact us.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Suggestion for better performance’ is closed to new replies.