disable zxcvbn.min.js in wordpress and woocommerce

前端 未结 4 1583
别跟我提以往
别跟我提以往 2021-02-10 13:41

As you know zxcvbn.min.js is around 400kb and loaded by default in wordpress websites , I want to know how I can prevent this JavaScript library to load As I don\'t want passwo

4条回答
  •  忘掉有多难
    2021-02-10 14:18

    The previous answer didn't worked for me, maybe because I usewp_enqueue_scripts so here is my setup that got me rid of the wc-password-strength-meter :

    function my_add_frontend_scripts() {
        // Deregister script about password strenght meter ~ 800kb
        wp_dequeue_script('wc-password-strength-meter');
        wp_deregister_script('wc-password-strength-meter');
    
        wp_register_script('custom-script', get_stylesheet_directory_uri().'/custom-script.js', array('jquery'), 1, false );
        wp_enqueue_script('custom-script');
        }
    
    add_action('wp_enqueue_scripts', 'my_add_frontend_scripts');
    

提交回复
热议问题