plechev

Untitled

Sep 30th, 2020
684
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function get_user_email($user_id = null) {
  2.     $user       = \get_user_by('id', $user_id);
  3.     $metas  = \get_user_meta($user_id);
  4.     $email  = \get_the_author_meta('user_email', $user_id);
  5.     return isset($metas['user_email'])  && !empty($metas['user_email']) ? $metas['user_email'][0] : (!empty($email) ? $email : $user->user_email);
  6.  };
RAW Paste Data