Title: Help! Selected the wrong post type, lost all posts
Last modified: September 21, 2022

---

# Help! Selected the wrong post type, lost all posts

 *  Resolved [nichols](https://wordpress.org/support/users/nicholsdatascience/)
 * (@nicholsdatascience)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/help-selected-the-wrong-post-type-lost-all-posts/)
 * I had a custom post type with many, many posts. I went into Edit Post Type and
   on the top right changed the Post Types drop down from Post Type to one of the
   other post type options. I got an error message saying it wasn’t a valid post
   type. When I tried to go back to change it back to Post Type, I discovered it
   had disappeared entirely, along with all the posts. I have no idea how to retrieve
   them. Am I going to have to reload my site from backup, or is there a way to 
   get my posts back?

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [3 years, 8 months ago](https://wordpress.org/support/topic/help-selected-the-wrong-post-type-lost-all-posts/#post-16032252)
 * Hi there,
 * Not quite sure what happened here and why, since our UI shouldn’t be doing THAT
   much with regards to changing details unless you were trying rename the slug 
   and whatnot. Even just clicking things with regards to switching which post type’s
   settings you’re using would only do that much, change out the post type. Not 
   try to rename or anything, and certainly not without clicking save.
 * Anyways, all of the post/post meta data should still be in the database, as we
   intently don’t delete anything for users. The post type they’re assigned just
   isn’t getting registered at the moment and thus the UI isn’t being generated.
 * If you have a local/dev copy with the same content/content types, you should 
   be able to visit the Tools menu and then the “Post Types” tab and get the settings
   in a JSON format, found on the right hand side, that can be imported back into
   the troublesome site, via the same page, but using hte left hand side.
 *  [karpathir](https://wordpress.org/support/users/karpathir/)
 * (@karpathir)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/help-selected-the-wrong-post-type-lost-all-posts/#post-16057439)
 * function themeprefix_show_cpt_archives( $query ) {
    if( is_category() || is_tag()&&
   empty( $query->query_vars[‘suppress_filters’] ) ) { $query->set( ‘post_type’,
   array( ‘post’, ‘nav_menu_item’, ‘ugyintezok’,’allasajalnalat’,’zart’,’jegyzokonyvek’));
   return $query; } } add_filter( ‘pre_get_posts’, ‘themeprefix_show_cpt_archives’);
 * //////////
    If this code snippet is included in funtcions.php then the post editor,
   category pruning does not work! This is the error: wrong post type.
 * Pls help me!
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [3 years, 8 months ago](https://wordpress.org/support/topic/help-selected-the-wrong-post-type-lost-all-posts/#post-16058711)
 * [@karpathir](https://wordpress.org/support/users/karpathir/)
 * Can you please start your own thread over at [https://wordpress.org/support/plugin/custom-post-type-ui/](https://wordpress.org/support/plugin/custom-post-type-ui/)
   instead of piggy backing off of the original issue and thread here? Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Help! Selected the wrong post type, lost all posts’ is closed to new 
replies.

 * ![](https://ps.w.org/custom-post-type-ui/assets/icon-256x256.png?rev=2744389)
 * [Custom Post Type UI](https://wordpress.org/plugins/custom-post-type-ui/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/custom-post-type-ui/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/custom-post-type-ui/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-post-type-ui/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-post-type-ui/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-post-type-ui/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * Last activity: [3 years, 8 months ago](https://wordpress.org/support/topic/help-selected-the-wrong-post-type-lost-all-posts/#post-16058711)
 * Status: resolved