I have been attempting to disable the ability to collapse admin meta boxes. By the looks of it WordPress creates this functionality in postbox.js /wp-admin/js/ but I have been unable to find a hook or suitable JavaScript to overwrite the built in functions.
This is a some test code I am working with:
jQuery('.postbox h3, .postbox .handlediv, .hndle').bind('click', function(e) {
e.preventDefault();
return false;
});
Any thoughts on how this could be achieved?
Add this to your functions file and it will kill the metabox toggles:
For current WordPress version (4.5.3) I come up with the following solution which removes closing metaboxes handler and opens all previously closed metaboxes.
php (plugin.php)
js (index.js)
If you want to use it inside theme you should replace
plugin_dir_url(__FILE__)
withget_template_directory_uri()
orget_stylesheet_directory_uri()
for a child theme.Simplified & best version :
//thanks to @jmarceli for hints