Rearranging Dashboard meta boxes with use of plugin/functions.php

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.

Related posts

1 comment

  1. 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

Comments are closed.