Site logo

Archived topic

Remove Page Header support from CPT

5 replies · Started by wekhter on August 17, 2017

Viewing posts 1–6 of 6

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)?

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' );
        }
    }
}

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

@Tom Thanks, all good now! :)

You're welcome :)

This archived topic is closed to new replies.