Search code examples
wordpresscsvcommentsexport-to-csvposts

How to export WordPress comments with post informations


I need to export all the comments on a WordPress website but I also need to have the post title of the currrent comments being exported.

Surprisingly none of the popular WP plugins seems to offer this possiblity. How would you do that?

I was thinking working with 2 sheets in Excel as I am capable to export the comments in one CSV and my posts in an another, but it seems really complicated for my current need.

I was hoping exporting one CSV file only in which I would have automatically the comment's informations but also the related post's informations.

Thanks in advance.


Solution

  • You can export Wordpress comments with post informations in PhpMyAdmin.

    This simple Query will be a good starting point:

    SELECT DISTINCT wp_comments.comment_ID, wp_comments.comment_post_ID,
      wp_comments.comment_author, wp_comments.comment_author_email, 
      wp_comments.comment_author_url,
      wp_comments.comment_author_IP,wp_comments.comment_date, 
      wp_comments.comment_content, wp_posts.ID, wp_posts.post_title 
    
    FROM `wp_comments` INNER JOIN `wp_posts` 
    
    WHERE wp_comments.comment_post_ID = wp_posts.ID 
    

    Up to you then to select the columns you want to export.