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 would like to make metaboxes as fixed elements, removing the expand function and the drag-and-drop function.

Any ideas?

share|improve this question

Deregistering the postbox script seemed a little bit drastic and as mentioned the "Edit" button for the permalink slug does not work as expected anymore.

I actually came up another method which uses filters from Wordpress and the functionality of the jQuery UI sortable plugin allowing to cancel the sort when it is issued from specific element(s) through the cancel option.


Wordpress 3.4.2 uses jQuery UI 1.8.20. Here's the initialization code that is used in postbox.js (I've stripped down the not relevant options):

    connectWith: ".meta-box-sortables",
    items: ".postbox",
    handle: ".hndle",

So the plugin creates a sortable list for elements .postbox. The sort is issued with the child element .hndle.


  1. Adding classes to the .postbox elements

    Wordpress provides a filter hook to customize the css classes added to the postboxes:


    {page} is the page the metabox is displayed on
    {id}is the metabox id

    So if I have a metabox with id "_movie_details_metabox" applied for a custom post type called "movie_type", you can do this:

    function metabox_not_sortable($classes) {
        $classes[] = 'not-sortable';
        return $classes;
    add_filter('postbox_classes_movie_type__movie_details_metabox', 'metabox_not_sortable');

  2. Alter jquery ui sortable instance

    Then you can insert a footer script in the admin area to alter the sortable instance to cancel the sort event if it is issued through the .hndle element from a postbox with the added css class not-sortable:

    function my_admin_print_footer_scripts()
        ?><script type="text/javascript">/* <![CDATA[ */
                    // define the cancel option of sortable to ignore sortable element
                    // for boxes with '.not-sortable' css class
                    .sortable('option', 'cancel', '.not-sortable .hndle, :input, button')
                    // and then refresh the instance
        /* ]]> */</script><?php

Postboxes with the css class .not-sortable cannot be sorted anymore, the other ones still can.

share|improve this answer

deregister the 'postbox' script. Place the following in your theme's functions.php or in a plugin file.

function dereg() {

I did a very cursory test and it does stop the dragging and the folding, and I don't notice anything broken.

The little folding arrow still show up but that is CSS not Javascript. If it bothers you you can kill it with:

function acss() {
echo '<style type="text/css">.postbox:hover .handlediv,
.stuffbox:hover .handlediv {display: none;
share|improve this answer
It seems to break the "Edit" button for changing the permalink slug. – Geert Nov 13 '12 at 19:10
It just kills the inline Javascript editing. You can still edit via the 'Slug' meta_box. It is annoying that that function is mixed into the same script, though. – s_ha_dum Nov 13 '12 at 19:19
I have spent some time trying a number of different things and have not been able to find any other way to prevent the dragging and folding. I keep thinking there must be another way but... – s_ha_dum Nov 14 '12 at 15:36

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.