Skip to content

Instantly share code, notes, and snippets.

@kneupmedia
Created November 18, 2017 13:03
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 kneupmedia/b1e94cc5bf3c2fb0ef1863cb113911f5 to your computer and use it in GitHub Desktop.
Save kneupmedia/b1e94cc5bf3c2fb0ef1863cb113911f5 to your computer and use it in GitHub Desktop.
Remove Custom Post Type - WordPress
if ( ! function_exists( 'unregister_post_type' ) ) :
function unregister_post_type() {
global $wp_post_types;
if ( isset( $wp_post_types[ 'post_type_name' ] ) ) {
unset( $wp_post_types[ 'post_type_name' ] );
return true;
}
return false;
}
endif;
add_action('init', 'unregister_post_type');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment