skip to Main Content

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

2

Answers


  1. Chosen as BEST ANSWER

    Update: This is a way, i resolved my problem :)

       add_action('admin_footer', 'disable_metabox_folding');
            function disable_metabox_folding()
            { ?><script>
            jQuery(window).load(function() {
               jQuery('.postbox').removeClass('closed');
            });
            </script><?php
        }
    

  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search