【WordPress自作】PHPでログインしている自分自身のユーザー名や名前を出力する方法

ユーザーID

<?php
 $author = get_userdata($post->post_author);
 echo $author->ID;
?>

ユーザー名

<?php
 $author = get_userdata($post->post_author);
 echo $author->display_name;
?>

ニックネーム

<?php
 $author = get_userdata($post->post_author);
 echo $author->nickname;
?>

<?php
 $author = get_userdata($post->post_author);
 echo $author->first_name;
?>

<?php
 $author = get_userdata($post->post_author);
 echo $author->last_name;
?>








この記事が気に入ったらサポートをしてみませんか?