0

我修改了我的代码。现在用户可以看到他们的评论,管理员可以看到所有用户的评论。但是用户仍然看不到管理员的评论。他们只看到他们的..我怎样才能做到这一点..

<?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(); ?>"

4

1 回答 1

0

好的,我在这里找到了解决方案

如果( $current_user_id == $comment->user_id || $post->post_author == $comment->user_id )

于 2018-09-21T13:21:24.177 回答