Skip to content

Instantly share code, notes, and snippets.

@WordBits
Created September 3, 2018 21:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WordBits/50ec2e0731a9cd449adf883a77797d7d to your computer and use it in GitHub Desktop.
Save WordBits/50ec2e0731a9cd449adf883a77797d7d to your computer and use it in GitHub Desktop.
Piece of code that I use regularly to unregister a WordPress post type. Just add/edit/remove the post type from lines 3, 4 and 5 and paste in your functions.php file.
<?php
// Download this snippet as a plugin and more at: https://wordbits.io/snippet/unregister-wordpress-post-types/
// Created by: Metal Potato
?>
<?php
function well_delete_post_type(){
unregister_post_type( 'portfolio' );
unregister_post_type( 'cms_block' );
unregister_post_type( 'uncode_gallery' );
}
add_action('init','well_delete_post_type');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment