こんにちは
考えてみました
<?php
add_filter( 'get_comment_author', 'my_comment_author_by_nickname' );
function my_comment_author_by_nickname( $author ) {
$comment = get_comment( $comment_ID );
if ( $comment->user_id ) ) {
$author = get_the_author_meta( 'nickname', $comment->user_id );
} else {
$author = __( 'Anonymous' );
}
return $author;
}
?>
で、うまく動作しますか?
gatespaceさま
アドバイスありがとうございます。
ユーザー数が150人ほどおりまして、現在も増え続けてます。
中には操作が苦手な方も多いため、自動的にニックネームにできないかな、と考えているためアドバイスいただいたような操作を促すのが難しい状態となっています。
nobitaさま
ありがとうござます。
いただいた内容、おはずかしながらどの部分に入力すればいいのかがわかりません。すみません。
functions.phpに記載してみましたが真っ白になってしまいます。
お手数ですがどのファイルにどのように記載すればよいかお教えいただけないでしょうか?
すみません、コードに不備がありました
functions.phpの最初に、(<?php
の前に)貼り付けてください
<?php
add_filter( 'get_comment_author', 'my_comment_author_by_nickname' );
function my_comment_author_by_nickname( $author ) {
$comment = get_comment( $comment_ID );
if ( $comment->user_id ) {
$author = get_the_author_meta( 'nickname', $comment->user_id );
}
return $author;
}
?>
nobitaさま
ありがとうございます!
無事に理想的な形になりました。
本当にありがとうございました。