Making product image meta box more prominent as a default (#33707)

This commit is contained in:
Joel Thiessen 2022-07-04 11:55:18 -07:00 committed by GitHub
parent 4707dcbec0
commit 6c13fdf0ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,4 @@
Significance: minor
Type: update
Making default state of product image meta boxes more prominent.

View File

@ -43,6 +43,7 @@ class WC_Admin_Meta_Boxes {
add_action( 'add_meta_boxes', array( $this, 'remove_meta_boxes' ), 10 );
add_action( 'add_meta_boxes', array( $this, 'rename_meta_boxes' ), 20 );
add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ), 30 );
add_action( 'add_meta_boxes', array( $this, 'add_product_boxes_sort_order' ), 40 );
add_action( 'save_post', array( $this, 'save_meta_boxes' ), 1, 2 );
/**
@ -166,6 +167,28 @@ class WC_Admin_Meta_Boxes {
}
}
/**
* Add default sort order for meta boxes on product page.
*/
public function add_product_boxes_sort_order() {
$current_value = get_user_meta( get_current_user_id(), 'meta-box-order_product', true );
if ( $current_value ) {
return;
}
update_user_meta(
get_current_user_id(),
'meta-box-order_product',
array(
'side' => 'submitdiv,postimagediv,woocommerce-product-images,product_catdiv,tagsdiv-product_tag',
'normal' => 'woocommerce-product-data,postcustom,slugdiv,postexcerpt',
'advanced' => '',
)
);
}
/**
* Remove bloat.
*/