Show WordPress comments of a post only from the logged in user

I try to get all comments of the current logged in user on the current post (and also the answer from the admin to this comments). The other users shouldn’t be able to see the comments from other users, except the top-level comments from admin.

                        $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 );

This doesn’t work, I get nothing. Do you know a way how to make “private” comments between users on posts possible?

Related posts

1 comment

Comments are closed.