title: WordPress autofill form with user name
body: <p>I have a WordPress site with forms on it. I am trying to autofill the name field in the form with the login name from WordPress. How can I do this? I tried some php <code>get current user name</code> but that did not work. Any help will be greatly appreciated.</p>
  
  <pre><code>&lt;?php
  //get current username
  global $ current_user; 
  $current_user=wp_get_current_user();
  $cuname=$current_user-&gt; user_name; ?&gt;
  
  // in the  form
  value="&lt;?php echo $cuname; ?&gt;" read only
  </code></pre>