• Resolved bestofbonus

    (@bestofbonus)


    I used this code in “wp-includes > functions.php” to disable the password strength meter in WordPress. It worked fine but I assume this could be wiped with any WordPress update so I wanted to put it in the Code snippets plugin instead:

    //disable zxcvbn.min.js in wordpress
    add_action('wp_print_scripts', 'remove_password_strength_meter');
    function remove_password_strength_meter() {
    // Deregister script about password strenght meter
    wp_dequeue_script('zxcvbn-async');
    wp_deregister_script('zxcvbn-async');
    }

    I get this error message:

    “The snippet has been deactivated due to an error on line 4:

    Cannot redeclare function remove_password_strength_meter.”

    Does anyone how I could change it and still be functional?

    Cheers,
    Stan

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Shea Bunge

    (@bungeshea)

    Hi Stan,

    The problem here is that you’re trying to run this code through code snippets while it’s also running in functions.php. Since the code creates a function and gives it a name, this causes a problem, as in PHP you can’t give two different functions the same name.

    An easy fix is to convert the code to using anonymous functions. This will ensure that this sort of naming conflict does not happen.

    // disable zxcvbn.min.js in wordpress
    add_action( 'wp_print_scripts', function () {
    	// Deregister script about password strength meter
    	wp_dequeue_script('zxcvbn-async');
    	wp_deregister_script('zxcvbn-async');
    } );
    Thread Starter bestofbonus

    (@bestofbonus)

    Thank you, I was able to fix it!

    Cheers,
    Stan

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Disable zxcvbn.min.js (password strength meter)’ is closed to new replies.