title: Wordpress how can i display user role on custom page?
body: <p>How can I display the user role on a custom page with php? There's one code, but it's just works on the author.php page. How do I run this code on a custom page?</p>
  
  <pre><code>&lt;?php $aid = get_the_author_meta('ID'); 
  $role = get_user_role($aid); 
  if ('subscriber' === $role)
  {
    echo "Subscriber";
  } 
  elseif ('editor' === $role)
  {
        echo "Editor";
  }`?&gt;`
  </code></pre>
  
  <p>Function.php</p>
  
  <pre><code>function get_user_role($id) {
      $user = new WP_User($id);
      return array_shift($user-&gt;roles);
  }
  </code></pre>