How Can I Unregister A WordPress Post Type

How Can I hide a custom post type for a specific WordPress blog

Have a look the following example code

if ( ! function_exists( 'unregister_custom_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;

$blog_id = get_current_blog_id();

if($blog_id = 1)
{
    add_action('init', 'unregister_custom_post_type');
}
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments