listshow comments of post author in special page

admin2025-06-06  3

i have a problem and i need you to save me really. i have many post authors with a lot of comments that every day is submitting. so i want to show comments that has submitted in every post to its post author in their user area to control them easily but i do not know to access WordPress admin area. so first, i want to know the posts that the current user ID has published and then, list the comments of those posts. of course except for those comments which the post author submitted as reply to others. please help me

i have a problem and i need you to save me really. i have many post authors with a lot of comments that every day is submitting. so i want to show comments that has submitted in every post to its post author in their user area to control them easily but i do not know to access WordPress admin area. so first, i want to know the posts that the current user ID has published and then, list the comments of those posts. of course except for those comments which the post author submitted as reply to others. please help me

Share Improve this question asked Nov 25, 2018 at 15:38 sh.dehnavish.dehnavi 411 silver badge12 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I found out it my self:

<?php
$post_ids = get_posts(array(
    'fields'        => 'ids', // Only get post IDs
    'posts_per_page'  => -1,
    'author'       => get_current_user_id(),
    'post_type' => 'post',
    'category' => 0, 
    'orderby' => 'date',
    'order' => 'DESC',
));
foreach($post_ids as $post_id) :

    $argss = array(
        'post_id' => $post_id,
        'status' => 'approve',
        'author__not_in' => get_current_user_id(),
    );
    $comments = get_comments($argss);
    foreach($comments as $comment) :
                echo "<div class=comment_listt>";
                echo '<i style="padding-left: 6px; font-size: 13px;">'. $comment->comment_author .'</i>';
                $greg_date = $comment->comment_date ; echo '(<i style="font-size: 13px;">'.jdate('d-m-Y H:i:s',strtotime($greg_date)).'</i>)';
                echo '<p style="padding:10px 0 0 0;">'. $comment->comment_content .'</p>';
                echo "<a href='". get_comment_link($comment->comment_ID)."'>go to reply</a></div>";
    endforeach;

endforeach;
?>
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749146016a316757.html

最新回复(0)