When importing – failed to import: Invalid post type feedback

The question:

I am attempting to import a site using XML generated by WordPress.com

All the posts and media seem to import, but the comments fail with errors

Failed to import “Sarah Toon - 2015-10-10 08:29:30”: Invalid post type feedback
Failed to import “Kylie - 2015-10-10 08:34:50”: Invalid post type feedback
Failed to import “Sophie Ward - 2015-10-10 08:36:22”: Invalid post type feedback

Reading other posts, here on WordPress.SE none of them have an accepted answer. The closest I could find is Custom post types not imported properly but that is about posts, not comments.

Can someone get me started on solving this please?

The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 1

The issue is you’re trying to import posts with a post type of feedback, but there is no such post type registered on your install of WordPress.

Quick-and-easy fix is to register one:

add_action( 'init', function () {
    register_post_type( 'feedback', [
        'public' => true,
        'labels' => [
            'singular_name' => 'Feedback',
            'name'          => 'Feedback',
        ]
    ]);
});

Place it in your theme’s functions.php, or in a MU plugin (eg. wp-content/mu-plugins/feedback.php).

Method 2

The Jetpack plugin creates a custom post type of feedback when active.
You may need to just install that plugin first (as I did).
Cheers!

Method 3

I was migrating a website from wordpress.com and I had same problem.

I’ve solved first installing the Jetpack plugin, then activating the Contact Form module in this url [yoursite.com]/wp-admin/admin.php?page=jetpack_modules and finally doing the import.

Hope that helps to someone!


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment