This article is inspired by Brad Cypert's blog post: http://www.bradcypert.com/building-a-simple-api-in-php-using-lumen/.
Why should we build a API with Vanilla PHP? Because you can, and it makes fun.
- Create a directory /src
This article is inspired by Brad Cypert's blog post: http://www.bradcypert.com/building-a-simple-api-in-php-using-lumen/.
Why should we build a API with Vanilla PHP? Because you can, and it makes fun.
add_action('woocommerce_process_registration_errors', 'validatePasswordReg', 10, 2 ); | |
function validatePasswordReg( $errors, $user ) { | |
// change value here to set minimum required password chars | |
if(strlen($_POST['password']) < 15 ) { | |
$errors->add( 'woocommerce_password_error', __( 'Password must be at least 15 characters long.' ) ); | |
} | |
// adding ability to set maximum allowed password chars -- uncomment the following two (2) lines to enable that | |
//elseif (strlen($_POST['password']) > 16 ) | |
//$errors->add( 'woocommerce_password_error', __( 'Password must be shorter than 16 characters.' ) ); |
<?php | |
/** | |
* Register custom rest fields | |
*/ | |
add_action( 'rest_api_init', 'register_custom_fields' ); | |
/** | |
* Register rest fields and endpoint | |
* |