logo
Ask your WordPress questions! Pay money and get answers fast! (more info)

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.

$5
Control Edit Post meta box display

I'm simply looking to set certain meta boxes inactive. I know about remove_meta_box() but I only want to make them inactive so that the user is still able to turn them back on from the screen options tab at the top.

Also, is there a function to collapse certain meta boxes and leave others open. I would like to focus the users attention to the important meta boxes by collapsing the others.


<EDIT>

I found the filter to use... default_hidden_meta_boxes but not sure how to do it. Using this how would I deactivate the custom fields meta box?

$hidden = apply_filters('default_hidden_meta_boxes', $hidden, $screen);

This question has been answered.

Joe Calithia | 12/10/10 at 10:34am Edit

Previous versions of this question: 12/16/10 at 10:25am

(3) Possible Answers Submitted...

See a chronological view of answers?

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

  • avatar
    Last edited:
    12/10/10
    11:05am
    Bob says:

    I have looked around and I do not think there is any "easy" way to accomplish this. As you said already it fairly easy to turn them off or on, but to have a dynamic option in the admin for users would require writing your own plugin.

    You can auto collapse the meta box's based on user role which would probably be a better idea. The opening or closing of the meta box's is controlled by an ajax call.

    You can see a reference for it in this post at the bottom under javascript
    http://www.code-styling.de/english/how-to-use-wordpress-metaboxes-at-own-plugins

    And here is a function that does what your asking for, I will just link to it because it requires explanation.
    http://wordpress.stackexchange.com/questions/4381/make-custom-metaboxes-collapse-by-default

    • 12/10/10 11:29am

      Joe Calithia says:

      Hmm. I've used the Adminimize plugin (http://wordpress.org/extend/plugins/adminimize/) and it functions the way I was hoping to do it. Based on the user role it deactivates the meta boxes you want but doesn't remove them. Do you know how this plugin does it?

    • 12/10/10 11:45pm

      Joe Calithia says:

      I found the filter to use... default_hidden_meta_boxes but not sure how to do it. Using this how would I deactivate the custom fields meta box?

      $hidden = apply_filters('default_hidden_meta_boxes', $hidden, $screen);

  • avatar
    Last edited:
    12/16/10
    4:03pm
    Rashad Aliyev says:

    Hello,

    It must be on here: wp-admin/includes/template.php Look at this.


    http://core.trac.wordpress.org/attachment/ticket/14212/14212.diff

  • avatar
    Last edited:
    12/18/10
    10:33pm
    Buzu B says:

    Joe Asked me to take a look at his problem. I sent him a solution.

This question has expired.





Current status of this question: Completed



Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.