michael.mcghee of Papercut Interactive
10/9/2018 - 2:30 PM

Unregister unused post types

If you're using a theme but don't need every single custom post type available you can remove them from the sidebar with the following code. In this example the "Project" custom post type will be removed. You can repeat unregister_post_type as needed within the delete_post_type function.

Note: unreigster_post_type() does not delete anything from the database. It only prevents the post type from being registered.

//Remove unused post types
function delete_post_type(){
    unregister_post_type( 'project' );
}

add_action('init','delete_post_type');