I am using a child theme, and wish to change one of the meta boxes defined in the parent theme.
The meta box is for ‘pages’ only.
I tried using the remove_meta_box in my functions.php, but it has no effect:
function remove_parents_box() {
remove_meta_box( 'id-of-meta-box' , 'page' , 'normal' );
}
add_action( 'admin_menu' , 'remove_parents_box' );
Any ideas?
Addition to question:
I found that the parent theme uses:
add_action( 'admin_menu', 'lala_create_meta_box_page' );
add_action( 'save_post', 'lala_save_meta_data_page' );
To initiate this meta box. As I wish to create the meta-box with my own code, should I actually remove it by something like:
remove_action( 'admin_menu', 'lala_create_meta_box_page',999 );
And then create my own meta-box?
Note: This is the merged version between my and @toscho answers.
Explanation (by @toscho)
Use
add_meta_boxes_page
as action hook.You can find the hook in
wp-admin/edit-form-advanced.php
and it displays as:Solution(s)
Try the following action, which is inside
register_post_type()
as well.If you know the exact position where the action, that adds the meta box is registered, you can also just remove this one.