2

I know how to remove meta boxes from dashboard, also how to add new ones, but is there a method that allows to rearrange them, for example move from side position to normal with use of functions.php or a plugin?

I know that it would require to fire only once somehow, to allow user to rearrange elements in the future, but in that case, it might just do it every time it loads - elements on dashboard are limited and functionality to rearrange them can be disabled completely.

4

add_meta_box has a the following placement parameters:

$context
'normal', 'advanced', 'side'

$priority 
'high', 'core', 'default' 'low'

For $context the difference between normal and advanced is that normal will be placed on the page before advanced.

The $priority determines the hierarchy but is overridden when dragged by the user. You can disable the drag and drop functionality.

Furthermore do_meta_boxes can be used to place (output) the registered meta box, for example if you want to place the meta box above the WYSIWYG editor you can use it in a function which fires edit_form_after_title.

If you only want to run an action once you can some trickery with did_action, for example:

function action_trickery_115819(){

    if(did_action('admin_init') === 1) {
    //some action to run once
    }
}
add_action( 'admin_init', 'action_trickery_115819' );

http://codex.wordpress.org/Function_Reference/do_meta_boxes http://codex.wordpress.org/Function_Reference/did_action

| improve this answer | |
  • The part with run once is quite interesting, but I can't take the knowledge with meta boxes to the working solution... how 'do_meta_boxes' could be used in this case... or perhaps You are sugesting to remove the metaboxes and add them again to new positions somehow ;). – Marcin Bobowski Sep 27 '13 at 6:08
  • 1
    Yes if you want to change positions you have to remove them and then re-add them. – Wyck Sep 27 '13 at 17:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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