Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm adding a meta box to a wordpress admin page. It works fine on my local server but when I upload it to the live server the meta box doesn't appear. Its does, however, appear in the screen options so I know the code is working, to some degree, its just not displaying anything on the edit page.

Does anyone have any ideas?

function ila_add_custom_box() {

    add_meta_box(
        'content-on-page',
        'Content On Page',
        'ila_render_meta_box',
        'page',
        'high'
    );
}

add_action( 'add_meta_boxes', 'ila_add_custom_box' );

function ila_render_meta_box(){ echo "<h1>Edit Page Options</h1>"; }

Thanks

Edit: I've switched all the plugins off and that didn't solve it

share|improve this question
    
Paste all the code here please –  Brad Dalton Jan 30 at 14:58
    
ok have done now –  danbrown Jan 30 at 15:02

1 Answer 1

up vote 1 down vote accepted

You missed one argument in the $args for add_meta_box.

The correct use would be (Codex):

add_meta_box( $id, $title, $callback, $post_type, $context, $priority, $callback_args );

You forgot to set the context, add it and you should be fine.

add_meta_box(
    'content-on-page',
    'Content On Page',
    'ila_render_meta_box',
    'page',
    'normal', // add this line
    'high'
);
share|improve this answer
    
Thanks that works perfectly :) –  danbrown Feb 14 at 10:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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