0

Found: Function create_function() is deprecated

The function is:

add_filter( 'woocommerce_min_password_strength', create_function( '', 'return 1;' ) );

I converted it to:

function wooc_password_check($checks) {
    if($checks==="") { return 1; }
}
add_filter( 'woocommerce_min_password_strength', 'wooc_password_check' );

Is this correct or do I need to do this another way?

fja3omega
  • 202
  • 5
  • 14
  • 1
    the answer given by @LoicTheAztec gives some more explanation, see: https://stackoverflow.com/a/43900628/11987538 your 'checks' variable is actually 'strength', and therefore only contains an integer. In your code you will compare this as a string. – 7uc1f3r Mar 05 '20 at 10:24
  • So I just change it to return 1 and change the checks to strength? – fja3omega Mar 05 '20 at 10:41
  • 1
    Yes, indeed. The number you choose depends on the strength you prefer when creating a password, as you could see with my already posted link. 3 => Strong (default) | 2 => Medium | 1 => Weak | 0 => Very Weak (anything). – 7uc1f3r Mar 05 '20 at 10:44

0 Answers0