• Resolved !Benni

    (@benniledl)


    Hi,

    I am currently developing a plugin and I wonder what I should do with all the posts of a custom post type when the user deactivates or uninstalls the plugin.

    On uninstalling I guess all the posts should be deleted but what about deactivation, the user probably does not want to delete all the posts when deactivating the plugin, but what happens to the posts of the custom post type when the custom post type isn’t being registered anymore because the plugin is deactivated, will that cause an error or are they just leftover “corpses” in the database and when reactivating it it will work again?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    In normal usage there would be no errors since WP doesn’t know the data is even there. There could be instances where there’s an invalid request for that post type from user custom code or something. That would generate an error, but if a user’s production site is properly configured to not display errors, it’s unlikely anyone would notice the errors.

    You can easily see for yourself by deactivating your own plugin. See if you can cause an error under any circumstance.

    When it comes to deleting posts on uninstall, ideally you’d prompt the user to confirm if they want the posts deleted or not.

Viewing 1 replies (of 1 total)
  • The topic ‘What do do with posts of a custom post type after deactivation of plugin’ is closed to new replies.