Support » Plugin: WordPress Comments Import & Export » Doesn’t import comments for Custom Post Types

  • Resolved mayuxi

    (@mayuxi)


    Hi!

    Thanks for amazing plugin! I used it to migrate from HyperComments (disqus-clone) back to WordPress native comments. I have only problem with Custom Post Types.

    I have special post types called “news”, and I want to import comments for this post types. Posts in this CPT has ID’s, which reachable by mybloc.com/?p=XXXX link, but your plugin can’t see them and return “This Post Does Not Exits” error.

    How can I fix it? Maybe manually? Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi @mayuxi,

    If you have trouble viewing the comment after import, please try updating the permalinks under WordPress settings menu. If the problem persists, please contact us with the details of the site and the post.

    Hi Mujeebur.

    No, I don’t have trouble with viewing the comments after import.

    I have problem with importing comments for Custom Post Type.
    I have CPT called “news”, and looks like your plugin only imports comments for post_type = “posts”
    I checked your code, and in /comments-import-export-woocommerce/includes/importer/class-hf_cmt_impexpcsv-import.php I saw this line (662):

            if ($cmd_type === 'comment') {
                $query = "SELECT ID FROM $wpdb->posts WHERE ID = %d AND post_type='post' AND comment_status='open'";
                $posts_that_exist = $wpdb->get_col($wpdb->prepare($query,$id));
                if (!$posts_that_exist) {
                    return true;
                }
                return false;

    So the post_type is hardcoded. I changed post_type from ‘post’ to ‘news’ and ran the import again. Everything works now.

    Thanks!

    Hi there!

    I’ve got a problem like @mayuxi but i have about 10 custom post types and i want to import comments to all of them.

    What exactly should i inscribe in /class-hf_cmt_impexpcsv-import.php to import comments to all my custom posts?

    Help plz!

    Hi @moiseika99,

    Comment Import Export plugin by default only supports to import and export comments with post type “post”. You may refer mayuxi’s previous reply to import your custom post types. You have to import all your 10 custom post type comments separately, each type editing the code.

    Any plans to natively incorporate custom post types for both import and export for this plugin?

    I’d rather not have to kludge code only for it to be overwritten on a new update, or to maintain my own version of the plugin independent of other sanctioned updates of this plugin.

    • This reply was modified 1 year, 5 months ago by jtcheng.
    Plugin Author webtoffee

    (@webtoffee)

    Hi @jtcheng,

    We understand your concern and will add your feedback to our backlogs and will consider it in future releases.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Doesn’t import comments for Custom Post Types’ is closed to new replies.