WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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) {

    return false;


Any thoughts on how this could be achieved?

share|improve this question
up vote 2 down vote accepted

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)
add_action('admin_footer', 'kill_postbox', 1);
share|improve this answer
Thanks Brian. That seems to the trick nicely. Do you know if removing the entire 'postbox' script in this way causes other issues? – Scott Oct 25 '11 at 9:12
It does affect user column preferences and the sortable metaboxes. You could clone postbox-dev.js and remove the toggle features, place it in your theme js folder and enqueue your hacked version with a dependency on 'jquery-ui-sortable'. This would preserve those other functions. – Brian Fegter Oct 25 '11 at 9:23
Thanks Brian. Luckily I do not need the sorting either so this is a silver bullet! – Scott Oct 25 '11 at 10:36
Doesn't seem to work (any more), postbox is removed from the in_footer array, but is loaded nonetheless. Found a working solution here, which neatly unbinds the click-handler, and leaves all other postbox functionality in place. – ptriek Nov 13 '13 at 12:59

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)

function add_admin_scripts( $hook ) {    
  wp_register_script( 'disable_metabox_toggling', plugin_dir_url(__FILE__) . 'index.js', 'jquery', '1.0.0', true);
  wp_enqueue_script( 'disable_metabox_toggling' );
add_action( 'admin_enqueue_scripts', 'add_admin_scripts', 10, 1 );

js (index.js)

  $(document).ready(function() {
     $('.postbox .hndle').unbind('click.postboxes');
     $('.postbox .handlediv').remove();

If you want to use it inside theme you should replace plugin_dir_url(__FILE__) with get_template_directory_uri()

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.