Show only current user's wordpress comments on page

Viewed 215

I have a website where I created an "answer and get a reply" page using wordpress comments.

Where the user posts a comment and then the admin replies it (me)

What I want: This logged in user must see only his comments (questions) and admin's replies (only the replies for his comments).

What I achieved so far: I'm using this piece of code

<?php
        $user_id = get_current_user_id();
        $user_specific_comments = get_comments(
            array(
                'user_id' => $user_id,
            )
        );

        wp_list_comments(
            array(
                'per_page' => 10,
            ),

            $user_specific_comments
        );
        ?>

As you can see, it gets the current user's ID and displays only his comments, good.

But that's also the problem, by the ID, it shows only his comments and not admin replies!

When change 'user_id' => $user_id to 'user_id' => array($user_id,1)

(1 = admin ID)

Then it shows all his comments plus all admins comments posted for any other user.

What I want to achieve is: Show only comments posted for the current user plus only admin's replies for his comments.

Thank you in advance.

0 Answers
Related