WooCommerce Admin product “general data” postbox issue

I have strange problem with woocommerce product data options. Instead of opened by default, mine is closed on page opening.

I tried with this function to remove “closed” class, but without success. Any advices for this?

add_filter( "postbox_classes_product_woocommerce-product-data", 'product_postbox_data_open' );
function product_postbox_data_open( $classes ) {
    array_splice( $classes, 'closed' );

  return $classes;
}

enter image description here

Answer

You need to remove from wp_usermeta for your user_id the row that has closedpostboxes_product as meta key, via phpMyAdmin…

You can also do it running once this function (by browsing any page as an admin):

add_action( 'init', function(){
    if( current_user_can('administrator') ) {
        delete_user_meta( get_current_user_id(), 'closedpostboxes_product' );
    }
});

Code goes in functions.php file of the active child theme (or active theme). Remove it after usage.

Leave a Reply

Your email address will not be published. Required fields are marked *