• I want to remove most of the metaboxes off the editing page for a particular role. One of them is the featured image metabox. In my code I have in a function:

    function author_remove_boxes ...
    remove_meta_box( 'postimagediv', 'post', 'normal' );

    that function is called as such:

    add_action('admin_init', 'author_remove_boxes');

    Even in the wordpress code I found such:

    wp-admin/edit-form-advanced.php: add_meta_box('postimagediv', __('Featured Image'), 'post_thumbnail_meta_box', $post_type, 'side', 'low');

    However, my featured image metabox is still appearing. All the other boxes I’ve tried have disappeared. Any thoughts anyone?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Yes – i have the same problem

    Code in meta-boxes.php looks like:

    /**
    * Display post thumbnail meta box.
    *
    * @since 2.9.0
    */
    function post_thumbnail_meta_box() {
    global $post;
    $thumbnail_id = get_post_meta( $post->ID, ‘_thumbnail_id’, true );
    echo _wp_post_thumbnail_html( $thumbnail_id );
    }

    Code in edit_form_advanced.php looks like:

    if ( current_theme_supports( ‘post-thumbnails’, $post_type ) && post_type_supports( $post_type, ‘thumbnail’ )
    && ( ! is_multisite() || ( ( $mu_media_buttons = get_site_option( ‘mu_media_buttons’, array() ) ) && ! empty( $mu_media_buttons[‘image’] ) ) ) )
    add_meta_box(‘postimagediv’, __(‘Featured Image’), ‘post_thumbnail_meta_box’, $post_type, ‘side’, ‘low’);

    … nothing effect to change Parameter

    Moderator keesiemeijer

    (@keesiemeijer)

    Try:
    add_action('admin_menu','author_remove_boxes');

    Moderator keesiemeijer

    (@keesiemeijer)

    I think this works:

    add_action('do_meta_boxes', 'author_remove_boxes');

    I have the same problem. The only way I overcome it was by injecting some javascript code via any hook (added it to another meta box I added):

    jQuery("#postimagediv").hide();

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘removing postimagediv’ is closed to new replies.