SHARE
TWEET

Shortcode Username

pustakakoran Apr 14th, 2017 (edited) 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function custom_shortcode_func() {
  2.     ob_start();
  3.     $username = wp_get_current_user();
  4.     echo '<b>' . $username->display_name . '</b>';
  5.     $output = ob_get_clean();
  6.     return $output;
  7. }
  8. add_shortcode('username', 'custom_shortcode_func');
  9.  
  10. [username]
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top