Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Remove Custom Post Types and Taxonomies in Wordpress

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 715
    Comment on it

    Hello readers, In this blog I will teach you how to remove custom post type and taxonomies.

    The below code is the custom taxonomies of the parent theme inside the functions.php add_action( 'after_setup_theme', 'parent_gallery_add_post_type' );

    function parent-gallery-add-post-type() {
    
        $parent-args = array(
            // other arguments...
            'rewrite' => array( 'slug' => 'gallery' ),
            'supports' => array( 'title', 'editor', 'author', 'excerpt' )
        );
        register-post-type( 'gallery', $parent-args );
    }
    

    If you can remove or overwrite the above code into your child theme you can just copy the below code. First you remove or disable the parent theme function in your child theme.

    function remove-parent-theme-features() {
        remove-action( 'init', 'parent-movie-add-post-type' );
        add-action( 'init', 'child-gallery-post-type' );
    }
    
    function child-movie-post-type() {
        $child-args = array(
            'rewrite' => array( 'slug' => 'child-gallery' ),
            'supports' => array( 'title', 'editor', 'author', 'thumbnail' )
        );
    
        register-post-type( 'gallery', $child-args );
    }
    

    I hope it helps you. Thank-you!!

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: