Viewing 1 replies (of 1 total)
  • Plugin Author Jesin A

    (@jesin)

    The following code lists email address that did not pass validation and deletes them.

    <?php
    add_action( 'wp_ajax_validate-users', 'validate_users_email' );
    
    function validate_users_email() {
        if ( ! current_user_can( 'delete_users' ) ) {
            echo 'Permission denied'; die;
        }
        $users = get_users( 'role=subscriber' );
        foreach( $users as $user ) {
            if ( ! is_email( $user->user_email ) ) {
                echo $user->user_login . ' ' . $user->user_email . '<br>';
                wp_delete_user( $user->ID );
            }
        }
        die;
    }

    Add this code to the functions.php file, login as an administrator and navigate to the following URL:

    https://yoursite.com/wp-admin/admin-ajax.php?action=validate-users
Viewing 1 replies (of 1 total)
  • The topic ‘Scanning Existing Users' Email Addresses’ is closed to new replies.