仅在wordpress仪表板上显示作者评论

仅在wordpress仪表板上显示作者评论,wordpress,comments,Wordpress,Comments,我从这里的某个地方得到了这段代码,以便在仪表板中只显示作者的评论。但它甚至没有在作者仪表板上显示任何评论或作者帖子 请帮我改正一下 function my_plugin_get_comment_list_by_user($clauses) { if (is_admin()) { global $user_ID, $wpdb; $clauses['join'] = ", wp_posts"; $clauses['where'] .= " AND wp_posts.post_author = ".$

我从这里的某个地方得到了这段代码,以便在仪表板中只显示作者的评论。但它甚至没有在作者仪表板上显示任何评论或作者帖子

请帮我改正一下

function my_plugin_get_comment_list_by_user($clauses) { if (is_admin()) { global $user_ID, $wpdb; $clauses['join'] = ", wp_posts"; $clauses['where'] .= " AND wp_posts.post_author = ".$user_ID." AND wp_comments.comment_post_ID = wp_posts.ID"; }; return $clauses; }; // Ensure that editors and admins can moderate all comments if(!current_user_can('edit_others_posts')) { add_filter('comments_clauses', 'my_plugin_get_comment_list_by_user'); }

通过一些自定义设置使用此选项:

<?php
  $my_id = 7;
  $comment_id_7 = get_comment( $my_id, ARRAY_A );
  $name = $comment_id_7['comment_author'];
?> 
也可以使用以下方法:

<div class="commentlist"><?php wp_list_comments(array('style' => 'div')); ?></div>

可能是我的错我没有发布完整的代码。。这是完整的代码。我正在寻找仪表板评论部分,而不是前端。此代码用于显示作者在仪表板评论部分的帖子评论。因此,作者只能看到他/她的帖子评论,也可以进行调整。然而,使用下面的代码它会消失所有的评论,即使是作者自己的帖子评论。这是我正在使用的代码。。。函数my_plugin_get_comment_list_by_user$clauses{if is_admin{global$user_ID,$wpdb;$clauses['join']=,wp_posts;$clauses['where'].=和wp_posts.post作者=。$user_ID.和wp_comments.comment_post_ID=wp_posts.ID;};返回$clauseas;//确保编辑和管理员可以在以下情况下缓和所有评论!当前用户可以“编辑他人帖子”{add_filter'comments_子句“,“我的插件”\u get_comment_list_by_user”;}