Support » Plugin: Autoptimize » Can’t Remove zxcvbn.min.js

  • Resolved kidnhockit

    (@kidnhockit)



    Hello,

    I wanna remove zxcvbn.min.js.
    I use scrpit:
    function iconic_remove_password_strength() {
    wp_dequeue_script( ‘wc-password-strength-meter’ );
    }
    add_action( ‘wp_print_scripts’, ‘iconic_remove_password_strength’, 10 );

    But I can’t remove.
    JS load to autoptimize/js/autoptimize_988278c70502de8a00fbc1916e213f6b.js:185

    Help me,

    Thank you !!!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    can you share your website’s URL so I can take a quick look @kidnhockit ?

    kidnhockit

    (@kidnhockit)

    Hi ^^

    My website: https://dienthoaivui.com.vn/

    Thank you <3

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    well, looking at the source of your un-autoptimized homepage (you can disable AO on a per-request basis by adding ?ao_noptimize=1 to the URL), I still see;

    
    <script type='text/javascript'>
    /* <![CDATA[ */
    var _zxcvbnSettings = {"src":"https:\/\/dienthoaivui.com.vn\/wp-includes\/js\/zxcvbn.min.js"};
    /* ]]> */
    </script>
    <script type='text/javascript' src='https://dienthoaivui.com.vn/wp-includes/js/zxcvbn-async.min.js'></script>

    so your dequeuing is not working, which explains why AO is still aggregating the file as well.

    where/ how did you add that code snippet?

    kidnhockit

    (@kidnhockit)

    I add code to Functions.php of Flatsome (Child-Theme).

    • This reply was modified 4 months ago by  kidnhockit.
    Plugin Author Optimizing Matters

    (@optimizingmatters)

    well, for reasons I don’t know it isn’t working I’m afraid. thought about trying this on my local dev-machine, but can’t seem to find the woocommerce option that triggers this being added in the first place?

    what you could do (but this is a “nuclear” option is use this code snippet to let AO zap all of that password-strenght stuff (it removes and JS that has zxcvbn or password-strength in the filename or if inline JS in the code);

    
    add_filter('autoptimize_filter_js_removables','remove_zxcvbn_js');
    function remove_zxcvbn_js($in) {
        return $in . ", zxcvbn, password-strength";
    }

    to be clear; this can break things, so it would be better to fix whatever is breaking your original snippet. and if you do use it; test your site thoroughly!

    frank

    kidnhockit

    (@kidnhockit)

    Thanks a lot,
    I will check my website.
    I will report on success.
    Thank you again.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.