SHARE
TWEET

WP-PHP: username, email, user ID, total post

pustakakoran Apr 8th, 2017 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. USERNAME:
  2. <?php
  3.     $current_user = wp_get_current_user();
  4.     /**
  5.      * @example Safe usage: $current_user = wp_get_current_user();
  6.      * if ( !($current_user instanceof WP_User) )
  7.      *     return;
  8.      */
  9.     echo '<b>' . $current_user->user_login . '</b>';
  10. ?>
  11.  
  12. EMAIL:
  13. <?php
  14.     $current_user = wp_get_current_user();
  15.     /**
  16.      * @example Safe usage: $current_user = wp_get_current_user();
  17.      * if ( !($current_user instanceof WP_User) )
  18.      *     return;
  19.      */
  20.     echo '<b>' . $current_user->user_email . '</b>';
  21. ?>
  22.  
  23. ID USER:
  24. <?php
  25.     $current_user = wp_get_current_user();
  26.     echo '<b>' . $current_user->ID . '</b>';
  27. ?>
  28.  
  29. TOTAL POST:
  30. <?php
  31. $count_posts = wp_count_posts();
  32. echo $count_posts->publish;
  33. ?>
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