• Resolved nichols

    (@nicholsdatascience)


    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

    (@tw2113)

    The BenchPresser

    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.

    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

    (@tw2113)

    The BenchPresser

    @karpathir

    Can you please start your own thread over at https://ww.wp.xz.cn/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.