Skip to content

Instantly share code, notes, and snippets.

View walidmahade's full-sized avatar
🏠
Working from home

Mahade Walid walidmahade

🏠
Working from home
View GitHub Profile
@walidmahade
walidmahade / vanilla-api.md
Created January 13, 2022 14:55 — forked from dexit/vanilla-api.md
Building a Simple Web API with Vanilla PHP
@walidmahade
walidmahade / wc-min-pass-chars-req.php
Created October 31, 2020 12:24 — forked from rynaldos-zz/wc-min-pass-chars-req.php
[WooCommerce 3.0] Require minimum password length for account registration, password update, and password resets
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.' ) );
@walidmahade
walidmahade / extend-wp-rest-api.php
Created September 20, 2019 20:54 — forked from mahlamusa/extend-wp-rest-api.php
Extend WordPress REST API with custom rest fields and endpoints
<?php
/**
* Register custom rest fields
*/
add_action( 'rest_api_init', 'register_custom_fields' );
/**
* Register rest fields and endpoint
*