Disable collapse of admin meta boxes

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?

3 Answers
3

Add this to your functions file and it will kill the metabox toggles:

function kill_postbox(){
    global $wp_scripts;
    $footer_scripts = $wp_scripts->in_footer;
    foreach($footer_scripts as $key => $script){
        if('postbox' === $script)
            unset($wp_scripts->in_footer[$key]);
    }
}
add_action('admin_footer', 'kill_postbox', 1);

Leave a Comment