Show only comments made on author posts

Asked

Viewed 75 times

0

I would like to know how to make this code I found in the forum of WordPress displays only comments made on logged user posts (Author logged in) in the WordPress.

I want to display this list on footer and already use the function is_user_logged_in() in my footer, but it is to make the following code list only the recent comments of the logged user posts.
Follows the code:

<ol class="commentlist">
<?php
    //Gather comments for a specific page/post 
    $comments = get_comments(array(
        'post_id' => XXX,
        'status' => 'approve' //Change this to the type of comments to be displayed
    ));

    //Display the list of comments
    wp_list_comments(array(
        'per_page' => 10, //Allow comment pagination
        'reverse_top_level' => false //Show the latest comments at the top of the list
    ), $comments);
?>

  • Add more details to the question. Where’s your problem? You’re not getting to filter the posts per user? Or you are not able to limit the amount of records that are brought in the query?

  • Does your new question is duplicate this?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.