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 extent but it’s just not displaying anything on the edit page.
I’ve uninstalled all the plugins and that didn’t equally solve the issue.
Below is my code:
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>";
}
How can I resolve it?
You missed one argument in the
$args
foradd_meta_box
.The correct use would be (Codex):
You forgot to set the
context
, add it and you should be fine.The correct code