remove_meta_box

The timeline below displays how wordpress function remove_meta_box has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 4.6

/**
 * Removes a meta box from one or more screens.
 *
 * @since 2.6.0
 * @since 4.4.0 The `$screen` parameter now accepts an array of screen IDs.
 *
 * @global array $wp_meta_boxes
 *
 * @param string                 $id      Meta box ID (used in the 'id' attribute for the meta box).
 * @param string|array|WP_Screen $screen  The screen or screens on which the meta box is shown (such as a
 *                                        post type, 'link', or 'comment'). Accepts a single screen ID,
 *                                        WP_Screen object, or array of screen IDs.
 * @param string                 $context The context within the screen where the box is set to display.
 *                                        Contexts vary from screen to screen. Post edit screen contexts
 *                                        include 'normal', 'side', and 'advanced'. Comments screen contexts
 *                                        include 'normal' and 'side'. Menus meta boxes (accordion sections)
 *                                        all use the 'side' context.
 */
function remove_meta_box($id, $screen, $context)
{
    global $wp_meta_boxes;
    if (empty($screen)) {
        $screen = get_current_screen();
    } elseif (is_string($screen)) {
        $screen = convert_to_screen($screen);
    } elseif (is_array($screen)) {
        foreach ($screen as $single_screen) {
            remove_meta_box($id, $single_screen, $context);
        }
    }
    if (!isset($screen->id)) {
        return;
    }
    $page = $screen->id;
    if (!isset($wp_meta_boxes)) {
        $wp_meta_boxes = array();
    }
    if (!isset($wp_meta_boxes[$page])) {
        $wp_meta_boxes[$page] = array();
    }
    if (!isset($wp_meta_boxes[$page][$context])) {
        $wp_meta_boxes[$page][$context] = array();
    }
    foreach (array('high', 'core', 'default', 'low') as $priority) {
        $wp_meta_boxes[$page][$context][$priority][$id] = false;
    }
}

WordPress Version: 4.4

/**
 * Removes a meta box from one or more screens.
 *
 * @since 2.6.0
 * @since 4.4.0 The `$screen` parameter now accepts an array of screen IDs.
 *
 * @global array $wp_meta_boxes
 *
 * @param string                 $id      Meta box ID (used in the 'id' attribute for the meta box).
 * @param string|array|WP_Screen $screen  The screen or screens on which the meta box is shown (such as a
 *                                        post type, 'link', or 'comment'). Accepts a single screen ID,
 *                                        WP_Screen object, or array of screen IDs.
 * @param string                 $context Optional. The context within the screen where the boxes
 *                                        should display. Available contexts vary from screen to
 *                                        screen. Post edit screen contexts include 'normal', 'side',
 *                                        and 'advanced'. Comments screen contexts include 'normal'
 *                                        and 'side'. Menus meta boxes (accordion sections) all use
 *                                        the 'side' context. Global default is 'advanced'.
 */
function remove_meta_box($id, $screen, $context)
{
    global $wp_meta_boxes;
    if (empty($screen)) {
        $screen = get_current_screen();
    } elseif (is_string($screen)) {
        $screen = convert_to_screen($screen);
    } elseif (is_array($screen)) {
        foreach ($screen as $single_screen) {
            remove_meta_box($id, $single_screen, $context);
        }
    }
    if (!isset($screen->id)) {
        return;
    }
    $page = $screen->id;
    if (!isset($wp_meta_boxes)) {
        $wp_meta_boxes = array();
    }
    if (!isset($wp_meta_boxes[$page])) {
        $wp_meta_boxes[$page] = array();
    }
    if (!isset($wp_meta_boxes[$page][$context])) {
        $wp_meta_boxes[$page][$context] = array();
    }
    foreach (array('high', 'core', 'default', 'low') as $priority) {
        $wp_meta_boxes[$page][$context][$priority][$id] = false;
    }
}

WordPress Version: 4.3

/**
 * Remove a meta box from an edit form.
 *
 * @since 2.6.0
 *
 * @global array $wp_meta_boxes
 *
 * @param string        $id      String for use in the 'id' attribute of tags.
 * @param string|object $screen  The screen on which to show the box (post, page, link).
 * @param string        $context The context within the page where the boxes should show ('normal', 'advanced').
 */
function remove_meta_box($id, $screen, $context)
{
    global $wp_meta_boxes;
    if (empty($screen)) {
        $screen = get_current_screen();
    } elseif (is_string($screen)) {
        $screen = convert_to_screen($screen);
    }
    $page = $screen->id;
    if (!isset($wp_meta_boxes)) {
        $wp_meta_boxes = array();
    }
    if (!isset($wp_meta_boxes[$page])) {
        $wp_meta_boxes[$page] = array();
    }
    if (!isset($wp_meta_boxes[$page][$context])) {
        $wp_meta_boxes[$page][$context] = array();
    }
    foreach (array('high', 'core', 'default', 'low') as $priority) {
        $wp_meta_boxes[$page][$context][$priority][$id] = false;
    }
}

WordPress Version: 3.7

/**
 * Remove a meta box from an edit form.
 *
 * @since 2.6.0
 *
 * @param string $id String for use in the 'id' attribute of tags.
 * @param string|object $screen The screen on which to show the box (post, page, link).
 * @param string $context The context within the page where the boxes should show ('normal', 'advanced').
 */
function remove_meta_box($id, $screen, $context)
{
    global $wp_meta_boxes;
    if (empty($screen)) {
        $screen = get_current_screen();
    } elseif (is_string($screen)) {
        $screen = convert_to_screen($screen);
    }
    $page = $screen->id;
    if (!isset($wp_meta_boxes)) {
        $wp_meta_boxes = array();
    }
    if (!isset($wp_meta_boxes[$page])) {
        $wp_meta_boxes[$page] = array();
    }
    if (!isset($wp_meta_boxes[$page][$context])) {
        $wp_meta_boxes[$page][$context] = array();
    }
    foreach (array('high', 'core', 'default', 'low') as $priority) {
        $wp_meta_boxes[$page][$context][$priority][$id] = false;
    }
}