Tag: domain

×Warning: This tutorial was created 2039 days ago. Some of the information may be out of date with more recent versions of Formidable. Please proceed with caution and always perform a backup before adding custom code.

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]

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right