I want to display comments using a Post slider plugin, but comments aren't posts.

I had a dodgy setup with FeedWordPress (sydnication plugin) by sucking the Comments RSS feed in to to the Comments into Posts, but the RSS feed has mysteriously stopped updating. So I'm thinking it might be better to find a way to convert Comments into Posts in a different way.

I took a look at some post-type switchers, but didn't see any that considered Comments to be a post-type.

Any tips would be much appreciated. Thanks in advance!

  • What title will you use for the comments when converted to posts? – hacksy Sep 26 '11 at 15:09
  • I was happy with the title FeedWordPress patched together which was something like "Comment on Postname by Visitorname" – niftycorp Sep 27 '11 at 0:35

You can copy this code into a plugin and when activated will convert all comments into posts, and delete the comments (so you will not have duplicates)

You can also limit what kind of comments will be converted the posts using the parameters for get_comments ( http://codex.wordpress.org/Function_Reference/get_comments )

    register_activation_hook( __FILE__, 'wpse_29474_convert_to_posts' );
    function wpse_29474_convert_to_posts(){
        $comments = get_comments();

        foreach($comments as $comment) 

            $title=sprintf("Comment on %s by %s",$post->post_title,$comment->comment_author);
            $my_post = array(
                 'post_title' => $title,
                 'post_content' => $content,
                 'post_status' => 'publish',
                 'post_author' => 1
           wp_insert_post( $my_post );
           wp_delete_comment( $comment->comment_ID );

  • Worked perfectly. Thankyou so much @hansy-schmitt ! I only have 3 points so far but am happy to give them to you if there is a way to do that... – niftycorp Sep 27 '11 at 4:43

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.