Best practices for meta box placement?

It is hard to declare best practices here.

The placement depends on the content of the metabox: an editor field would be too narrow usually in the side column; two small checkboxes on the other hand will look lost in the main column.

To understand where which box will be placed, let’s use a small demo plugin:

add_action( 'add_meta_boxes_post', 'register_demo_metaboxes' );

function register_demo_metaboxes()
{
    $contexts   = array ( 'normal', 'advanced', 'side' );
    $priorities = array ( 'high', 'sorted', 'core', 'default', 'low' );

    foreach ( $contexts as $context )
        foreach ( $priorities as $priority )
            add_meta_box(
                "demo-$context-$priority", // id
                    "$context/$priority", // title
                    'demo_metabox_callback', // callback
                    NULL, // screen
                    $context,
                    $priority
            );
}
function demo_metabox_callback( $object, $box )
{
    static $count = 1;
    print "number " . $count++;
}

enter image description here

side/high and side/sorted will be placed above the Publish box, normal/high immediately after the editor, */low at the end of the screen and probably out of sight.

Some rules I try to follow:

  • Do not move the Publish box. Users might not figure out how to move the box down. This can be very annoying.
  • Try to understand how often a box might be used. A setting you turn on or off just one time per post should be very low.
  • Order by importance: boxes with required fields (price of a product) should be very prominent, a description that will be extracted from the main content if empty, doesn’t have to be visible all the time.
  • Some users will move the box out of sight, some might disable it completely. Prepare your callback handlers for that.
  • Use normal/default or side/default if you are not sure.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)