I am displaying a div in the Edit Post screen using add_meta_box(). This function provides very limited positioning options via "priority" and "context" params and these are not sufficient for my needs.

I need to be able to display the div below the Permalink but above the Insert Media button on Edit Post, specifically below the div "titlediv", above the div "postdivrich".

How else can I position the meta box on the post edit screen? Can this be done through jQuery?

Here's a partially working solution:

function admin_init(){
  add_meta_box("wd_meta", "WD Meta", "wd_meta", "post", "normal", "high");
add_action("admin_init", "admin_init");

function wd_meta() {
    global $post;
    $custom = get_post_custom($post->ID);
<div id="wdMeta">
<p>Display a message here.</p>

<?php } ?>

The meta box is displaying on the page correctly, but the javascript is not positioning it correctly, even though it appears to work in demo:


  • What exact position do you want to reach? For which metabox? – david.binda Feb 19 '13 at 11:49
  • @david.binda as he said, the position has to be below permalink section and above editor section. – Eugene Manuilov Feb 19 '13 at 11:54
  • Below the div "titlediv", above the div "postdivrich". I'll edit to add that. – AMcDermott Feb 19 '13 at 12:10
  • Short answer you can't via the WP interface. You have to remove 'editor' as a capabaility for the post type and re-add it a a custom meta box that you can move around. You could possibly do it with jquery though you'd have to watch out for lost event bindings. Which solution would you prefer? – sanchothefat Feb 19 '13 at 12:28
  • $(function() { $('#wd_meta').insertAfter('#titlediv'); }); - this seems to work in demo, but not in live Edit Post page: demo (apologies for formatting) – AMcDermott Feb 19 '13 at 13:02

You cannot use a real metabox to do that, hook into edit_form_after_title instead.

enter image description here

Here is a simple example:

add_action( 'edit_form_after_title', 'wpse_87478_pseudo_metabox' );
add_action( 'save_post', 'wpse_87478_save_metabox' );

function wpse_87478_pseudo_metabox()
    global $post;
    $key = '_wpse_87478';

    if ( empty ( $post ) || 'post' !== get_post_type( $GLOBALS['post'] ) )

    if ( ! $content = get_post_meta( $post->ID, $key, TRUE ) )
        $content = '';

        '<p><label for="%1$s_id">Enter some text
        <input type="text" name="%1$s" id="%1$s_id" value="%2$s" class="all-options" />
        esc_attr( $content )

function wpse_87478_save_metabox( $post_id )
    if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )

    if ( ! current_user_can( 'edit_post', $post_id ) )

    $key = '_wpse_87478';

    if ( isset ( $_POST[ $key ] ) )
        return update_post_meta( $post_id, $key, $_POST[ $key ] );

    delete_post_meta( $post_id, $key );
| improve this answer | |
  • If I followed the function get_post_type correctly, there's no need of the $_GLOBAL post key. At the end, get_post will use it if no argument is passed. – brasofilo Apr 4 '13 at 11:00
  • @brasofilo But our FAQ says be specific, so I am. :) – fuxia Apr 4 '13 at 11:01
  • I'd call it chirurgical ;) – brasofilo Apr 4 '13 at 11:04

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.