1

I have a CTP named leads and have 2 metaboxes added to the CPT new/edit screen. I need to have one of them only in edit screen, not in add new.

Played with the codes provided in couple of answers, but they weren't of much help. (97845 and 89395)

Can anyone help? I don't necessarily want anyone to do it for me, but a few playable starts would be great.

Thanks

1 Answer 1

6

Check the action of the current screen object for add:

function wpd_add_meta_box() {
    $screen = get_current_screen();
    if( 'add' != $screen->action ){
        add_meta_box(
            'myplugin_sectionid',
            'My meta box',
            'myplugin_meta_box_callback',
            'leads'
        );
    }
}
add_action( 'add_meta_boxes', 'wpd_add_meta_box' );
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.