Unregister Custom Post Types In WordPress


/**
* Unregister Custom Post Types
*
*/

function custom_unregister_theme_post_types() {
global $wp_post_types;
foreach( array( 'portfolio', 'clients', 'team', 'testimonials' ) as $post_type ) {
if ( isset( $wp_post_types[ $post_type ] ) ) {
unset( $wp_post_types[ $post_type ] );
}
}
}
add_action( 'init', 'custom_unregister_theme_post_types', 20 );

Credit goes to Themify for posting an actual solution that worked: Themify

Tweet It. Share It.

See more Code Snippet, php, Programming, Wordpress