獲得當前使用者
使用預定義的函式 wp_get_current_user();
獲取 wordpress 中當前使用者的所有資訊
<?php
$current_user = wp_get_current_user();
echo "Username :".$current_user->user_login;
echo "Username :".$current_user->ID;
echo "Username :".$current_user->user_pass;
echo "Username :".$current_user->user_nicename;
echo "Username :".$current_user->user_email;
echo "Username :".$current_user->user_url;
echo "Username :".$current_user->user_registered;
echo "Username :".$current_user->user_activation_key;
echo "Username :".$current_user->user_status;
echo "Username :".$current_user->display_name;
?>