Removing custom meta box added in parent theme

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?

Read More

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?

Related posts

Leave a Reply

1 comment

  1. 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:

    do_action('add_meta_boxes_' . $post_type, $post);
    

    Solution(s)

    Try the following action, which is inside register_post_type() as well.

    function wpse59607_remove_meta_box( $callback )
    {
        remove_meta_box( 'id-of-meta-box' , 'page' , 'normal' );
    }
    add_action( 'add_meta_boxes_page', 'wpse59607_remove_meta_box', 999 );
    

    If you know the exact position where the action, that adds the meta box is registered, you can also just remove this one.

    function wpse59607_remove_meta_box()
    {
        remove_action( 'admin_menu', 'lala_create_meta_box_page' );
    }
    add_action( '_admin_menu', 'wpse59607_remove_meta_box', 999 );