[Resolved] Remove Page Header support from CPT

Home Forums Support [Resolved] Remove Page Header support from CPT

Home Forums Support Remove Page Header support from CPT

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #368375
    wekhter

    I love the page header addon for pages, but the options show up on all of my CPTs, where it doesn’t need to be and clutters up the post editor. Any way to disable it on all but pages (and archives)?

    #368379
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    You could try this:

    add_action( 'add_meta_boxes', 'tu_remove_cpt_page_header_metabox', 100 );
    function tu_remove_cpt_page_header_metabox() {
        $post_types = get_post_types( array( 'public' => true ) );
    
        foreach ( $post_types as $type ) {
            if ( 'page' !== $type ) {
                remove_meta_box( 'generate_select_page_header_meta_box', $type, 'normal' );
            }
        }
    }
    #368792
    wekhter

    @Tom No such luck, the page header metabox still appears on all CPTs (for instance, WooCommerce products)

    #368849
    Tom
    Lead Developer
    Lead Developer

    I just adjusted the code above: https://generatepress.com/forums/topic/remove-page-header-support-from-cpt/#post-368379

    Let me know if it works now πŸ™‚

    #368912
    wekhter

    @Tom Thanks, all good now! πŸ™‚

    #368919
    Tom
    Lead Developer
    Lead Developer

    You’re welcome πŸ™‚

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.