Support » Plugin: Custom Post Type UI » Deleting a custom post type leaves annoying remnants lying around database

  • Resolved Cory Simmons


    So I created a Custom Post Type called “services”, I made some services and decided I wanted to change those services to child pages, so I deleted my custom post type via the Custom Post Type UI interface.

    I created my child pages and went to view their webpage and it wasn’t displaying the right template.

    Immediately I knew it was a database issue and when I looked at my database, I noticed a bunch of “services” under the “post_type” column in wp_posts.

    I’m sure there are tons of relationships and such mapped to the old/deleted custom post type, and that’s what’s causing my pages to break.

    Is this an inherit problem with how WP deletes custom post types? If not, can you update the plugin to actually nuke the custom post types from the database completely? If not, does anyone know of a plugin that will do that?


    Update Simple enough to fix. Just SELECT * FROM wp_posts WHERE post_type = ‘services’, then delete.

    I’m sure there are remnants somewhere else, but I’ll cross that bridge when I come to it unless someone has a more elegant solution.

Viewing 2 replies - 1 through 2 (of 2 total)
  • I believe I ran into an issue with this as well where old data remnants caused an issue. I have been testing this plugin out to see what it does and I have been adding and deleting post types.

    Suddenly all my custom post types were not appearing in the WP Menu. The only way I could clear up the problem was to delete all of the data and reinstall WP and start from scratch.

    I think the main error that started causing my problems was a space in the custom post name of one of the custom post types I tested. It was after adding that one that all my troubles started. However, I think that if the remnants of this were not laying around in the database, I would not have needed to purge the DB and restart.

    Hope the info helps in some way, but I am in complete agreement that when the custom post type is deleted that all related data should be purged, perhaps with an option to apply any existing posts in a post type to another post type?

    Plugin Author Michael Beckwith


    Data deletion is a tricky subject to manage, as some people won’t care, some people will. I’m a believer in offering the option that takes explicit permission to delete the plugin-created data, otherwise just leave it alone.

    With something like CPT posts, I think they should be left in unless otherwise told, because you could ditch this UI plugin and register the post type yourself in the exact same way, preserving and regaining all of the associated data with it.

    I’m going to note down for future consideration a button/checkbox/something that says “delete all plugin-created data”.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Deleting a custom post type leaves annoying remnants lying around database’ is closed to new replies.