Main Content

Remove meta box on specific post type

We will remove custom meta box on specific post type. `remove_meta_box( $id, $screen, $context )`

Parameters

  • $id (string) (Required) Meta box ID (used in the ‘id’ attribute for the meta box).
  • $screen (string|array|WP_Screen) (Required) The screen or screens on which the meta box is shown (such as a post type, ‘link’, or ‘comment’).
  • $context (string) (Required) The context within the screen where the box is set to display. Contexts vary from screen to screen. Post edit screen contexts include ‘normal’, ‘side’, and ‘advanced’.
add_action( 'admin_menu' , 'wpdocs_remove_post_custom_fields', 100 );
 
/**
 * Remove Custom Fields meta box
 */
function wpdocs_remove_post_custom_fields() {
    remove_meta_box( 'metabox-id' , 'post-type' , 'normal' ); 
}