获得当前用户

使用预定义的函数 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;
        
    ?>