Skip to content

Instantly share code, notes, and snippets.

View voboghure-dev's full-sized avatar
🏠
Working from home

Tapan Kumer Das voboghure-dev

🏠
Working from home
View GitHub Profile
$ npx npm-check-updates -u
$ npm install
/**
* For test and debug, log function to view any data in wp-content/debug.log
* uses: log_it($variable);
*
*/
if ( ! function_exists( 'log_it' ) ) {
function log_it( $message ) {
if ( WP_DEBUG === true ) {
if ( is_array( $message ) || is_object( $message ) ) {
error_log( "\r\n" . print_r( $message, true ) );
@voboghure-dev
voboghure-dev / gist:150654069be06d31b4942d64d5d07ed0
Created May 16, 2024 14:38
Prevent creating spam new user in WordPress
// Blacklist woocommerce customer registration
function blacklisted_user( $errors, $sanitized_user_login, $user_email ) {
// Blacklist email domains
$blacklist = ['tmomail.net', 'vtext.com', 'txt.att.net'];
$email_parts = explode( '@', $user_email );
if ( is_numeric( $email_parts[0] ) ) {
// If the user email first part is numeric, add an error message
$errors->add( 'blacklist_error', '<strong>ERROR</strong>: This email is not allowed to register on this site.' );