Changing placement of a meta box on admin pages

I recently added a plugin, and the meta box on post and page screens appeared before the excerpt meta box.  The client was going to have multiple contributors and we didn’t want them to see this plug-in first (it had a very large meta box) and potentially forget that there was an excerpt box and custom fields further down.

How to move the meta box? It all hinges on a function called

add_meta_box

which takes a parameter called $priority – either ‘high’ or ‘low.’

I simply went into the plugin’s file and found this:

add_meta_box($this->prefix, $this->plugin_name, array(&$this, 'meta_box'), 'post', 'normal', 'high');
add_meta_box($this->prefix, $this->plugin_name, array($this, 'meta_box'), 'page', 'normal', 'high');

and switched it to this:

add_meta_box($this->prefix, $this->plugin_name, array(&$this, 'meta_box'), 'post', 'normal', 'low');
add_meta_box($this->prefix, $this->plugin_name, array($this, 'meta_box'), 'page', 'normal', 'low');

For more information on this function, read the WordPress codex page on add_meta_box.

I haven’t found out if there’s any other more precise way to place meta boxes within a column – the $context parameter lets you choose the column.  I know that users can move boxes around, but most of the time they don’t, so it’s important to be able to control the default order of boxes.

Comments, Corrections, Suggestions?

All trademarks and copyrights appearing on this website are the property of their respective owners. All rights Reserved.

Help Panel

I get an error message when I try to replay a video.
Most videos on this site are URL protected. If you don't watch a video within a minute, the URL expires. So if you want to replay a video, just refresh the page.

Key to Icons

  • Requires Administrator level
  • Video about a plugin
  • Browser issue
  • Video is a tutorial

WordPress Versions

  • Version 2.8
  • Version 2.9
  • Version 3.0
  • Version 3.1
  • Version 3.2
Help