我已经修改了我的代码。现在,用户可以看到他们的评论,管理员可以看到所有用户的评论。但是用户仍然不能看到管理员.They的评论,只能看到他们的评论..我该如何实现这一点..
<?php
/**
* Used as a callback by wp_list_comments() for displaying the comments.
*/
function _s_comment( $comment, $args, $depth )
{
$GLOBALS['comment'] = $comment;
$current_user_id = get_current_user_id();
$current_user = wp_get_current_user();
if ( 'pingback' == $comment->comment_type || 'trackback' == $comment->comment_type ) : ?>
<li id="comment-<?php comment_ID(); ?>" <?php comment_class(); ?>>
<div class="comment-body">
</div>
<?php elseif ( $current_user_id == $comment->user_id || ($current_user->roles[0] == 'administrator' ) : ?>
<li id="comment-<?php comment_ID(); ?>"
发布于 2018-09-21 21:21:24
好的,我已经找到解决方案了。
if( post作者$comment-> $current_user_id _id || $post->post_author == $comment->user_id )
https://stackoverflow.com/questions/52443958
复制相似问题