I have 2 metaboxes added to "page" type. But only in first case Wordpress (on its own) adds hide-if-js class to metabox container. Questin is - when does Wordpress add this hide-if-js to the metabox container div ??
First metabox add code - this one gets hide-if-js class automatically:
add_action( 'add_meta_boxes', 'add_portfolio_template_meta' );
function add_portfolio_template_meta() {
add_meta_box('projects-details-for-template', 'Portfolio template options:', 'projects_details_for_template_html', 'page', 'side', 'default');
}
Second metabox add script:
add_action( 'add_meta_boxes', 'add_contact_template_meta' );
function add_contact_template_meta() {
add_meta_box('contact-details-for-template', 'Contact page details:', 'contact_details_html', 'page', 'side', 'default');
}
Just ran into this today. Turns out it's related to the top "screen options" section (top right of the backend when editing a post, pulls open a new div).
The "hide-if-js" class will be on your metabox when the page is loaded if it's unselected in "screen options". To remove the class/make the metabox visible, check it off.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With