+917803057266

Home » Tips & Tricks » Remove Custom Post Type from a Theme

Remove Custom Post Type from a Theme

Add this block of code to your theme’s functions.php
Note: Change projects, employees or clients according to your theme custom post type.


/* Remove Custom Post Type */
add_action('init', 'theme_remove_post_type', 1);
function theme_remove_post_type( $post_type ) {
global $wp_post_types;
if ( isset( $wp_post_types['projects'] ) || isset( $wp_post_types['employees'] ) || isset( $wp_post_types['clients'] ) ) {
unset( $wp_post_types['projects'] );
unset( $wp_post_types['employees'] );
unset( $wp_post_types['clients'] );
return true;
}
return false;
}