11

My WP 3.3 setup involves several post types and customized edit panels with Advanced Custom Fields plugin (which creates many metaboxes) and other plugins such as SEO metabox panel, Scribu's Posts2Posts connections and more.

The problem is, the appearance order of these panels is often quite random (even if Adavanced Custom Fields offers some sort of ordering, but it doesn't always work, since other plugins don't have it and furthermore I might want to change metabox positions according to post types).

Now, Wordpress allows each administrator / user with proper rights to arrange the metaboxes in edit panels the way he/she wants. However... every admin has to arrange their own!! Isn't there a way to prepare a default/fixed ordering or let superadmin or one admin in particular to set the panels position for EVERYBODY?

I have at least 4 admins and few editors/authors... it doesn't make sense I have to set up their panels logging in with EACH of their accounts... it's stupid and time consuming, and confusing for non wordpress savvy users.

Is there any plugin or code snippet that could help my case?

thank you

1
  • somebody asked the same quetsions on wp forums 1 year ago, his topic was left with no answers, not resolved and some admin closed the thread wordpress.org/support/topic/…
    – unfulvio
    Apr 12, 2012 at 5:11

2 Answers 2

7

You can remove the default meta boxes with remove_meta_box and re-add them in a different position with add_meta_box:

add_action('do_meta_boxes', 'wpse33063_move_meta_box');

function wpse33063_move_meta_box(){
    remove_meta_box( 'postimagediv', 'post', 'side' );
    add_meta_box('postimagediv', __('Featured Image'), 'post_thumbnail_meta_box', 'post', 'normal', 'high');
}

The answer above is from the following thread: How to change default position of WP meta boxes?

UPDATE

If the main frustration is purely the amount of meta boxes available, and you do not think each user needs all the boxes, you can hide them from lower user roles or all roles using the following code added to the functions.php file. NOTE - This method simply hides the meta box and does not deactivate or remove them.

//Hide Post Page Options from all except Administrator
if (!current_user_can('administrator')){
function hide_post_page_options() {
global $post;
$hide_post_options = "<style type=\"text/css\"> #wptotwitter_div, wpseo_meta, #al2fb_meta, #misc-publishing-actions .misc-pub-section label, #misc-publishing-actions .misc-pub-section #post-status-display, #misc-publishing-actions .misc-pub-section .edit-post-status, #visibility.misc-pub-section, .al2fb_post_submit, #slugdiv, #edit-slug-box, #screen-options-link-wrap { display: none; }</style>";
print($hide_post_options);
}
add_action( 'admin_head', 'hide_post_page_options'  );
}

//Hide Post Page Options from ALL users
function hide_all_post_page_options() {
global $post;
$hide_all_post_options = "<style type=\"text/css\"> #taxonomy-category li.hide-if-no-js, #commentstatusdiv, #wypiekacz_sectionid, #postexcerpt, #trackbacksdiv, #postcustom, #yarpp_relatedposts { display: none !important; }</style>";
print($hide_all_post_options);
}
add_action( 'admin_head', 'hide_all_post_page_options'  );

Basically, you just need to enter the div id or class separated by a comma. I just left mine in there to show that all sorts of meta boxes and areas can be hidden.

#wptotwitter_div - WP to Twitter plugin
#wpseo_meta - Wordpress SEO by Yoastplugin
#al2fb_meta, .al2fb_post_submit - Add Link to Facebookplugin
#misc-publishing-actions .misc-pub-section label, #misc-publishing-actions .misc-pub-section #post-status-display, #misc-publishing-actions .misc-pub-section .edit-post-status, #visibility.misc-pub-section - Default Wordpress Publish Status and Visibility
#slugdiv, #edit-slug-box - The post slug
#screen-options-link-wrap - The "Screen Options" tab at the top of the page
#taxonomy-category li.hide-if-no-js - The "Most Used" categories tab
#commentstatusdiv - The comments on the post
#wypiekacz_sectionid - Wypiekacz plugin
#postexcerpt - Post excerpt
#trackbacksdiv - Trackbacks
#postcustom - Custom post fields
#yarpp_relatedposts - Yet Another Related Posts Plugin

(I put the examples in "code" because SE uses # to represent a heading)

I thought I would throw this out to you because, like you, I got extremely frustrated with all the meta boxes, but ultimately I think is was the sheer number of unwanted boxes. For an "author" on my website, it is now very streamlined: Title, Content, save as draft, publish now or schedule to be posted, tags, categories and featured image... No clutter at all.

5
  • That doesn't solve my problem, would like to do this copying my wysiwyg settings to all users (so I set the appearance of the panels once and for all); reason: some plugin add their own metaboxes; also, for different post types I want to place the metaboxes accordingly. Add_meta_box only has normal/high/low... with many many metaboxes that doesn't help. Advanced custom fields at least has a ordering number, but it doesn't work well in presence of other metaboxes. Best way to do this would be wysiwyg...
    – unfulvio
    Apr 12, 2012 at 7:08
  • Do you use and need all the additional meta boxes created by plugins? I ask because, for me, all the unneeded meta boxes is what always frustrates me. If that is in fact your case, I have made an UPDATE above that maybe if you simply hide the boxes that are not needed for certain user roles, your issue could be eliminated... It sure did for me! Apr 15, 2012 at 7:32
  • Why don't you remove the metaboxes by user rather than simply hiding them with styling? Apr 15, 2012 at 8:34
  • Not everything I remove is a meta box, some are parts of meta boxes, so I figured I would just use one function, rather than two. Apr 15, 2012 at 14:24
  • Travis, thank you for spending more this on this. However the CSS solution doesn't solve the problem of moving metaboxes (your previous solution of filtering and repositioning partially does). As I mentioned earlier, my setup has many custom post types with special metaboxes which I made and they have to be there. There's actually very few I want to hide (but they will be useful to some admins, so I don't want to remove them permanently and hiding by CSS is not a good move). I have yet to find a satisfactory solution for this issue. Thank you anyway for the effort.
    – unfulvio
    Apr 15, 2012 at 19:10
1

Have you looked into the Adminimize plugin?

It allows you to activate/deactivate meta boxes per user role and also configure the position. It takes a little bit to configure it and the documentation is decent, albeit spotty in places but it should be able to handle what you are describing.

2
  • That plugin does not allow you to "configure the position", only visibility. It's a very nice plugin, tho..
    – frnhr
    Feb 16, 2013 at 16:40
  • I will confess to not having looked all that closely at the plugin but if it can manipulate one, it can probably be made to manipulate the other via some code additions. Makes for a nice launching point.
    – JCL1178
    Feb 16, 2013 at 18:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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