1
我嘗試獲取當前登錄用戶對當前帖子的所有評論(以及管理員對此評論的回答)。其他用戶應該無法看到來自其他用戶的評論,但管理員的頂級評論除外。只顯示來自登錄用戶的帖子的Wordpress評論
$args =array (
'status' => 'approve',
'type' => 'comment',
// 'post_author' => get_current_user_id(),
'post_status' => 'publish',
'post_type' => 'post',
'user_id' => get_current_user_id(),
'number' => 20,
'offset' => 0,
'order' => 'DESC',
'orderby' => 'comment_date',
'count' => true,
);
$comments = get_comments($args);
// Referer to http://codex.wordpress.org/Function_Reference/wp_list_comments
$list_args = array(
'reverse_top_level' => false // Show the latest comments at the top of the list
);
wp_list_comments($list_args, $comments);
這不行,我什麼也沒得到。您是否知道如何在帖子之間的用戶之間進行「私密」評論?
我不想要的功能:顯示註釋僅當用戶登錄! - 我想顯示來自logged_in用戶的評論! =>您只能看到自己發表的評論以及管理員對您評論的回覆。 – Suisse