How to display logged in users comments (only) on Wordpress

I'm currently building a niche Q+A site using wordpress with which users can either log in and post questions or log in and answer questions.

Questions are currently being stored as posts, and answers stored as comments. I want question answerers to be able to log in and view all their comments (answers) on one page with a link to the original post (question).

I can easily list posts in this way (i.e. list all of the logged in users posts on one page i.e. their original questions) but cant seem to do this with comments (i.e. list all the logged in user's answers on one page.) Is there any way to do this?


  1. Click on Settings > Discussions and set what you want from there. There is one option that lets only registered members to post a comment.
  2. - see code from line #39, same aproach also in your case.

The query for the comments is the normal wordpress way, but you need to include it in the conditionals linked and pointed above.

Usage example:

if ( is_user_logged_in() ) {
    $user_id = get_current_user_id();
    $args = array(
        'status' => 'approve',
        'order' =>  'DESC',
        'user_id' => $user_id
    $comments = get_comments($args);
    foreach($comments as $comment) :
        echo '<p>'; 
        echo($comment->comment_author . '<br />' . $comment->comment_content);
        echo '</p>';

Need Your Help

JSON request for Telize GeoIP

jquery json geoip

I was using the api to show prices based on location. Recently the API was shutdown and switched to a paid service. I'm having some trouble fixing my code so that it works with the paid

Can' Add window Class library in Silverlight project

silverlight silverlight-3.0

Can Any body tell why window class library can't be added in the silverlight project. I have created window class library but can't add that class library in the Silverlight project ?? any idea why...