From 4018ca4ed3408a2d6cace45b3280a2a486caa570 Mon Sep 17 00:00:00 2001 From: Shiva Poudel Date: Sat, 22 Aug 2015 02:52:05 +0545 Subject: [PATCH] Tweak - Hide default Custom Fields Meta-Boxes, Closes #8924 --- includes/admin/class-wc-admin-post-types.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/includes/admin/class-wc-admin-post-types.php b/includes/admin/class-wc-admin-post-types.php index 7a222cc6102..3783f2990b2 100644 --- a/includes/admin/class-wc-admin-post-types.php +++ b/includes/admin/class-wc-admin-post-types.php @@ -81,6 +81,7 @@ class WC_Admin_Post_Types { add_filter( 'enter_title_here', array( $this, 'enter_title_here' ), 1, 2 ); add_action( 'edit_form_after_title', array( $this, 'edit_form_after_title' ) ); add_filter( 'media_view_strings', array( $this, 'change_insert_into_post' ) ); + add_filter( 'default_hidden_meta_boxes', array( $this, 'hidden_meta_boxes' ), 10, 2 ); add_action( 'post_submitbox_misc_actions', array( $this, 'product_data_visibility' ) ); // Uploads @@ -2086,6 +2087,20 @@ class WC_Admin_Post_Types { return $strings; } + /** + * Hidden default Meta-Boxes. + * @param array $hidden + * @param object $screen + * @return array + */ + public function hidden_meta_boxes( $hidden, $screen ) { + if ( 'product' === $screen->post_type && 'post' === $screen->base ) { + $hidden = array_merge( $hidden, array( 'postcustom' ) ); + } + + return $hidden; + } + /** * Output product visibility options. */