Add this snippet to your functions.php file or use the Code Snippets plugin:
add_shortcode('users-email-domain',extract_domain_func); function extract_domain_func(){ $current_user = wp_get_current_user(); $email = $current_user->user_email; if( filter_var( $email, FILTER_VALIDATE_EMAIL ) ) { // split on @ and return last value of array (the domain) $domain = array_pop(explode('@', $email)); return $domain; } }
Usage [users-email-domain]