Skip to content

Instantly share code, notes, and snippets.

@onepoint0
onepoint0 / gist:2f1861f9ae05eb1c947f7fa8b42529e2
Created April 9, 2025 06:17
Change Wordpress User Login & Registration Error messages to avoid User Enumeration
<?php
add_filter('woocommerce_process_registration_errors', 'clario_override_registration_error_messages', 999,4);
// woocommerce_process_registration_errors fires before the username and email already exist check (so in a sense it is too early),
// however once these checks happen, the code immediate throws an error and returns so no later hooks are available to handle
// changing the error messages
function clario_override_registration_error_messages($errors,$username, $password, $email) {
if ( username_exists( $username ) ) {