Skip to content

Instantly share code, notes, and snippets.

@kosinix
Last active December 19, 2015 21:08
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 kosinix/6017616 to your computer and use it in GitHub Desktop.
Save kosinix/6017616 to your computer and use it in GitHub Desktop.
There's not currently an unregister_post_type function in WP, but it's quite simple to do with the code provided by Nacin on WordPress Trac:
<?php
if ( ! function_exists( 'unregister_post_type' ) ) :
function unregister_post_type( $post_type ) {
global $wp_post_types;
if ( isset( $wp_post_types[ $post_type ] ) ) {
unset( $wp_post_types[ $post_type ] );
return true;
}
return false;
}
endif;
unregister_post_type('my_custom_post');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment