• Resolved Al

    (@aliv2)


    Is there a way to export pages that have comments allowed on them? I am only able to select posts.

    • This topic was modified 3 years, 8 months ago by Al.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author WebToffee

    (@webtoffee)

    Hi @aliv2,

    Please use the below code snippet to export page comments. You may please copy the snippet in the active theme’s functions.php file.

    add_filter('product_Comments_csv_product_export_args', 'wtproduct_Comments_csv_product_export_args');
    function wtproduct_Comments_csv_product_export_args($args){
        if(isset($args['post_type']) && $args['post_type'] == 'Post'){
            $args['post_type'] = 'Post,page'; 
        }
        return $args;
    }
    Thread Starter Al

    (@aliv2)

    Hi @webtoffee thank you for your help. I am able to export comments from pages but still have an error.

    Both sites are identical. I backed up my live site and restored it to a staging site a few days ago. Want to update staging with comments from live since last backup.

    To test I exported one comment as “Download to CSV” from a live site page(not post), but when I import it into staging site I get an error saying “The post doesn’t exist.”

    Anything I can do to fix this?

    • This reply was modified 3 years, 8 months ago by Al.
    Plugin Author WebToffee

    (@webtoffee)

    Hi @aliv2,

    Kindly make sure that you specify the correct post ID in the commnet_post_ID columns of the CSV file. The ID of the posts on the exporting and importing site might be different. Please ensure that the CSV file contains correct post IDs.

    Thread Starter Al

    (@aliv2)

    Hi @webtoffee I did some further testing as the issue still persists

    1. I removed all plugins and used WP theme Twenty Twenty-One for this test.
    2. Added the code you provided above to the Twenty Twenty-One functions.php file
    2. Validated that the Post ID does exist in the wp_posts table.

    Upon import of just one comment(from a page) I continue to get the “The post doesn’t exist” error.

    Using your plugin if I export all comments the resulting CSV has a lot of errors and warnings.

    Could it be due to the code you provided as your plugin does work for posts?

    Plugin Author WebToffee

    (@webtoffee)

    Hi @aliv2,

    Could you please share the CSV file that is used for importing and the CSV that you exported using the plugin so that we can check it? You may please share it with us via support.

    Plugin Author WebToffee

    (@webtoffee)

    Hi @aliv2,

    We have released a new version of the plugin. Please update the plugin to the latest version(Ver. 2.2.6) and copy the below snippet in the active theme’s functions.php file of the importing site and then try importing the exported file to import the page comments.

    add_filter('wt_cmt_imp_post_exists_query', 'wt_cmt_imp_post_exists_query');
    
    function wt_cmt_imp_post_exists_query($query) {
        global $wpdb;
        $query = "SELECT ID FROM $wpdb->posts WHERE ID = %d AND (post_type='post' OR post_type='page')";
        return $query;
    }

    Dear

    I have the same problem. I want to export comments from pages. I add the code to my theme functions.php but I don′t see the option to export comments from pages… only articles are allowed.

    Can you help me?

    Regards

    Plugin Author WebToffee

    (@webtoffee)

    Hi @pionnex,

    Please note that there will be no extra option through which you can select the pages. Please just click on the Export comments button and the page comments will be exported along with the other comments.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Exporting comments on pages’ is closed to new replies.