Unregister Custom Post Type

Sometimes I create a custom post type and decide that I want to change the name after it’s already been created. Unfortunately, it’s not as simple as just going into the functions file and renaming, as that will just create another custom post type. So, instead, you need to unregister your initial post type and then create a new on with your desired name, slug, etc.

Fortunately, unregistering is super simple. Just put this code in your functions file (and delete your “incorrect” and/or “old” custom post type code):

add_action( 'init', 'undo_custom_post_type' );
function undo_custom_post_type() {
    remove_action('init', 'PUT YOUR CUSTOM POST TYPE NAME HERE');
}