-1

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

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;
?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.