Removing custom post types

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #28053
    Ann Zumwinkle
    Participant

    Hi again. This time we are trying to removing some of the custom post types that our client is not using, to avoid their confusion. I have been able to remove some of them by using:
    function mo_register_pricing_post_type() {
    }
    or
    function mo_register_course_post_type() {
    }
    in the functions.php file of the child theme. This does not, however, seem to work for all of the post types we wish to remove, namely portfolio, gallery, or showcase slides. We were using the taxonomy acquired by rolling over the post type link in the dashboard menu, which works for some post types, but those terms don’t seem to work for those last 3 post types. Can you point us in the right direction? Thanks again for your help.

    #28055
    Veena
    Moderator

    You can use the following snippet in your child theme functions.php file to remove any custom post type defined by the theme –

    
    function delete_post_type(){
        unregister_post_type( 'department' );
    }
    add_action('init','delete_post_type', 13);
    

    The above example is for department custompost type.

    #28168
    Ann Zumwinkle
    Participant

    OK, thanks. I presume I would replace the word ‘department, with one of the other post types, such as gallery_item, showcase_slide, etc. Does the number 13 need to be replaced as well?

    #28169
    Ann Zumwinkle
    Participant

    BTW, can I use this more than once, or do I add other post types to this one instance? The site seems to crash if I use it more than once.

    #28174
    Veena
    Moderator

    Can you pls try like this?

    
    function delete_post_type(){
        unregister_post_type( 'portfolio' );
        unregister_post_type('departments');
        unregister_post_type('testimonials');
    }
    add_action('init','delete_post_type');
    
Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Invent Theme Support’ is closed to new topics and replies.