Custom post types and taxonomies can be registered using register_post_type()
and register_taxonomy()
. These functions do not actually create any data in the database. Data is added when users populate content (posts and taxonomies).
When a plugin is disabled, any post types and taxonomies that it registers will be unregistered, but all of their data in the database will remain in place.
If you are going to remove data from the database, you should make it abundantly clear to the user what is happening. One common pattern is to require the user to click an option that states that they want data to be deleted when deleting the plugin. The data deletion process can be run using the register_uninstall_hook()
or uninstall.php
file. Data should not be removed when simply deactivating a plugin.