do_meta_boxes

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

WordPress Version: 6.4

/**
 * Meta-Box template function.
 *
 * @since 2.5.0
 *
 * @global array $wp_meta_boxes
 *
 * @param string|WP_Screen $screen      The screen identifier. If you have used add_menu_page() or
 *                                      add_submenu_page() to create a new screen (and hence screen_id)
 *                                      make sure your menu slug conforms to the limits of sanitize_key()
 *                                      otherwise the 'screen' menu may not correctly render on your page.
 * @param string           $context     The screen context for which to display meta boxes.
 * @param mixed            $data_object Gets passed to the meta box callback function as the first parameter.
 *                                      Often this is the object that's the focus of the current screen,
 *                                      for example a `WP_Post` or `WP_Comment` object.
 * @return int Number of meta_boxes.
 */
function do_meta_boxes($screen, $context, $data_object)
{
    global $wp_meta_boxes;
    static $already_sorted = false;
    if (empty($screen)) {
        $screen = get_current_screen();
    } elseif (is_string($screen)) {
        $screen = convert_to_screen($screen);
    }
    $page = $screen->id;
    $hidden = get_hidden_meta_boxes($screen);
    printf('<div id="%s-sortables" class="meta-box-sortables">', esc_attr($context));
    /*
     * Grab the ones the user has manually sorted.
     * Pull them out of their previous context/priority and into the one the user chose.
     */
    $sorted = get_user_option("meta-box-order_{$page}");
    if (!$already_sorted && $sorted) {
        foreach ($sorted as $box_context => $ids) {
            foreach (explode(',', $ids) as $id) {
                if ($id && 'dashboard_browser_nag' !== $id) {
                    add_meta_box($id, null, null, $screen, $box_context, 'sorted');
                }
            }
        }
    }
    $already_sorted = true;
    $i = 0;
    if (isset($wp_meta_boxes[$page][$context])) {
        foreach (array('high', 'sorted', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ((array) $wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false === $box || !$box['title']) {
                        continue;
                    }
                    $block_compatible = true;
                    if (is_array($box['args'])) {
                        // If a meta box is just here for back compat, don't show it in the block editor.
                        if ($screen->is_block_editor() && isset($box['args']['__back_compat_meta_box']) && $box['args']['__back_compat_meta_box']) {
                            continue;
                        }
                        if (isset($box['args']['__block_editor_compatible_meta_box'])) {
                            $block_compatible = (bool) $box['args']['__block_editor_compatible_meta_box'];
                            unset($box['args']['__block_editor_compatible_meta_box']);
                        }
                        // If the meta box is declared as incompatible with the block editor, override the callback function.
                        if (!$block_compatible && $screen->is_block_editor()) {
                            $box['old_callback'] = $box['callback'];
                            $box['callback'] = 'do_block_editor_incompatible_meta_box';
                        }
                        if (isset($box['args']['__back_compat_meta_box'])) {
                            $block_compatible = $block_compatible || (bool) $box['args']['__back_compat_meta_box'];
                            unset($box['args']['__back_compat_meta_box']);
                        }
                    }
                    ++$i;
                    // get_hidden_meta_boxes() doesn't apply in the block editor.
                    $hidden_class = (!$screen->is_block_editor() && in_array($box['id'], $hidden, true)) ? ' hide-if-js' : '';
                    echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
                    echo '<div class="postbox-header">';
                    echo '<h2 class="hndle">';
                    if ('dashboard_php_nag' === $box['id']) {
                        echo '<span aria-hidden="true" class="dashicons dashicons-warning"></span>';
                        echo '<span class="screen-reader-text">' . __('Warning:') . ' </span>';
                    }
                    echo $box['title'];
                    echo "</h2>\n";
                    if ('dashboard_browser_nag' !== $box['id']) {
                        $widget_title = $box['title'];
                        if (is_array($box['args']) && isset($box['args']['__widget_basename'])) {
                            $widget_title = $box['args']['__widget_basename'];
                            // Do not pass this parameter to the user callback function.
                            unset($box['args']['__widget_basename']);
                        }
                        echo '<div class="handle-actions hide-if-no-js">';
                        echo '<button type="button" class="handle-order-higher" aria-disabled="false" aria-describedby="' . $box['id'] . '-handle-order-higher-description">';
                        echo '<span class="screen-reader-text">' . __('Move up') . '</span>';
                        echo '<span class="order-higher-indicator" aria-hidden="true"></span>';
                        echo '</button>';
                        echo '<span class="hidden" id="' . $box['id'] . '-handle-order-higher-description">' . sprintf(
                            /* translators: %s: Meta box title. */
                            __('Move %s box up'),
                            $widget_title
                        ) . '</span>';
                        echo '<button type="button" class="handle-order-lower" aria-disabled="false" aria-describedby="' . $box['id'] . '-handle-order-lower-description">';
                        echo '<span class="screen-reader-text">' . __('Move down') . '</span>';
                        echo '<span class="order-lower-indicator" aria-hidden="true"></span>';
                        echo '</button>';
                        echo '<span class="hidden" id="' . $box['id'] . '-handle-order-lower-description">' . sprintf(
                            /* translators: %s: Meta box title. */
                            __('Move %s box down'),
                            $widget_title
                        ) . '</span>';
                        echo '<button type="button" class="handlediv" aria-expanded="true">';
                        echo '<span class="screen-reader-text">' . sprintf(
                            /* translators: %s: Hidden accessibility text. Meta box title. */
                            __('Toggle panel: %s'),
                            $widget_title
                        ) . '</span>';
                        echo '<span class="toggle-indicator" aria-hidden="true"></span>';
                        echo '</button>';
                        echo '</div>';
                    }
                    echo '</div>';
                    echo '<div class="inside">' . "\n";
                    if (WP_DEBUG && !$block_compatible && 'edit' === $screen->parent_base && !$screen->is_block_editor() && !isset($_GET['meta-box-loader'])) {
                        $plugin = _get_plugin_from_callback($box['callback']);
                        if ($plugin) {
                            $meta_box_not_compatible_message = sprintf(
                                /* translators: %s: The name of the plugin that generated this meta box. */
                                __('This meta box, from the %s plugin, is not compatible with the block editor.'),
                                "<strong>{$plugin['Name']}</strong>"
                            );
                            wp_admin_notice($meta_box_not_compatible_message, array('additional_classes' => array('error', 'inline')));
                        }
                    }
                    call_user_func($box['callback'], $data_object, $box);
                    echo "</div>\n";
                    echo "</div>\n";
                }
            }
        }
    }
    echo '</div>';
    return $i;
}

WordPress Version: 6.3

/**
 * Meta-Box template function.
 *
 * @since 2.5.0
 *
 * @global array $wp_meta_boxes
 *
 * @param string|WP_Screen $screen      The screen identifier. If you have used add_menu_page() or
 *                                      add_submenu_page() to create a new screen (and hence screen_id)
 *                                      make sure your menu slug conforms to the limits of sanitize_key()
 *                                      otherwise the 'screen' menu may not correctly render on your page.
 * @param string           $context     The screen context for which to display meta boxes.
 * @param mixed            $data_object Gets passed to the meta box callback function as the first parameter.
 *                                      Often this is the object that's the focus of the current screen,
 *                                      for example a `WP_Post` or `WP_Comment` object.
 * @return int Number of meta_boxes.
 */
function do_meta_boxes($screen, $context, $data_object)
{
    global $wp_meta_boxes;
    static $already_sorted = false;
    if (empty($screen)) {
        $screen = get_current_screen();
    } elseif (is_string($screen)) {
        $screen = convert_to_screen($screen);
    }
    $page = $screen->id;
    $hidden = get_hidden_meta_boxes($screen);
    printf('<div id="%s-sortables" class="meta-box-sortables">', esc_attr($context));
    /*
     * Grab the ones the user has manually sorted.
     * Pull them out of their previous context/priority and into the one the user chose.
     */
    $sorted = get_user_option("meta-box-order_{$page}");
    if (!$already_sorted && $sorted) {
        foreach ($sorted as $box_context => $ids) {
            foreach (explode(',', $ids) as $id) {
                if ($id && 'dashboard_browser_nag' !== $id) {
                    add_meta_box($id, null, null, $screen, $box_context, 'sorted');
                }
            }
        }
    }
    $already_sorted = true;
    $i = 0;
    if (isset($wp_meta_boxes[$page][$context])) {
        foreach (array('high', 'sorted', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ((array) $wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false === $box || !$box['title']) {
                        continue;
                    }
                    $block_compatible = true;
                    if (is_array($box['args'])) {
                        // If a meta box is just here for back compat, don't show it in the block editor.
                        if ($screen->is_block_editor() && isset($box['args']['__back_compat_meta_box']) && $box['args']['__back_compat_meta_box']) {
                            continue;
                        }
                        if (isset($box['args']['__block_editor_compatible_meta_box'])) {
                            $block_compatible = (bool) $box['args']['__block_editor_compatible_meta_box'];
                            unset($box['args']['__block_editor_compatible_meta_box']);
                        }
                        // If the meta box is declared as incompatible with the block editor, override the callback function.
                        if (!$block_compatible && $screen->is_block_editor()) {
                            $box['old_callback'] = $box['callback'];
                            $box['callback'] = 'do_block_editor_incompatible_meta_box';
                        }
                        if (isset($box['args']['__back_compat_meta_box'])) {
                            $block_compatible = $block_compatible || (bool) $box['args']['__back_compat_meta_box'];
                            unset($box['args']['__back_compat_meta_box']);
                        }
                    }
                    $i++;
                    // get_hidden_meta_boxes() doesn't apply in the block editor.
                    $hidden_class = (!$screen->is_block_editor() && in_array($box['id'], $hidden, true)) ? ' hide-if-js' : '';
                    echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
                    echo '<div class="postbox-header">';
                    echo '<h2 class="hndle">';
                    if ('dashboard_php_nag' === $box['id']) {
                        echo '<span aria-hidden="true" class="dashicons dashicons-warning"></span>';
                        echo '<span class="screen-reader-text">' . __('Warning:') . ' </span>';
                    }
                    echo $box['title'];
                    echo "</h2>\n";
                    if ('dashboard_browser_nag' !== $box['id']) {
                        $widget_title = $box['title'];
                        if (is_array($box['args']) && isset($box['args']['__widget_basename'])) {
                            $widget_title = $box['args']['__widget_basename'];
                            // Do not pass this parameter to the user callback function.
                            unset($box['args']['__widget_basename']);
                        }
                        echo '<div class="handle-actions hide-if-no-js">';
                        echo '<button type="button" class="handle-order-higher" aria-disabled="false" aria-describedby="' . $box['id'] . '-handle-order-higher-description">';
                        echo '<span class="screen-reader-text">' . __('Move up') . '</span>';
                        echo '<span class="order-higher-indicator" aria-hidden="true"></span>';
                        echo '</button>';
                        echo '<span class="hidden" id="' . $box['id'] . '-handle-order-higher-description">' . sprintf(
                            /* translators: %s: Meta box title. */
                            __('Move %s box up'),
                            $widget_title
                        ) . '</span>';
                        echo '<button type="button" class="handle-order-lower" aria-disabled="false" aria-describedby="' . $box['id'] . '-handle-order-lower-description">';
                        echo '<span class="screen-reader-text">' . __('Move down') . '</span>';
                        echo '<span class="order-lower-indicator" aria-hidden="true"></span>';
                        echo '</button>';
                        echo '<span class="hidden" id="' . $box['id'] . '-handle-order-lower-description">' . sprintf(
                            /* translators: %s: Meta box title. */
                            __('Move %s box down'),
                            $widget_title
                        ) . '</span>';
                        echo '<button type="button" class="handlediv" aria-expanded="true">';
                        echo '<span class="screen-reader-text">' . sprintf(
                            /* translators: %s: Hidden accessibility text. Meta box title. */
                            __('Toggle panel: %s'),
                            $widget_title
                        ) . '</span>';
                        echo '<span class="toggle-indicator" aria-hidden="true"></span>';
                        echo '</button>';
                        echo '</div>';
                    }
                    echo '</div>';
                    echo '<div class="inside">' . "\n";
                    if (WP_DEBUG && !$block_compatible && 'edit' === $screen->parent_base && !$screen->is_block_editor() && !isset($_GET['meta-box-loader'])) {
                        $plugin = _get_plugin_from_callback($box['callback']);
                        if ($plugin) {
                            ?>
							<div class="error inline">
								<p>
									<?php 
                            /* translators: %s: The name of the plugin that generated this meta box. */
                            printf(__('This meta box, from the %s plugin, is not compatible with the block editor.'), "<strong>{$plugin['Name']}</strong>");
                            ?>
								</p>
							</div>
							<?php 
                        }
                    }
                    call_user_func($box['callback'], $data_object, $box);
                    echo "</div>\n";
                    echo "</div>\n";
                }
            }
        }
    }
    echo '</div>';
    return $i;
}

WordPress Version: 6.2

/**
 * Meta-Box template function.
 *
 * @since 2.5.0
 *
 * @global array $wp_meta_boxes
 *
 * @param string|WP_Screen $screen      The screen identifier. If you have used add_menu_page() or
 *                                      add_submenu_page() to create a new screen (and hence screen_id)
 *                                      make sure your menu slug conforms to the limits of sanitize_key()
 *                                      otherwise the 'screen' menu may not correctly render on your page.
 * @param string           $context     The screen context for which to display meta boxes.
 * @param mixed            $data_object Gets passed to the meta box callback function as the first parameter.
 *                                      Often this is the object that's the focus of the current screen,
 *                                      for example a `WP_Post` or `WP_Comment` object.
 * @return int Number of meta_boxes.
 */
function do_meta_boxes($screen, $context, $data_object)
{
    global $wp_meta_boxes;
    static $already_sorted = false;
    if (empty($screen)) {
        $screen = get_current_screen();
    } elseif (is_string($screen)) {
        $screen = convert_to_screen($screen);
    }
    $page = $screen->id;
    $hidden = get_hidden_meta_boxes($screen);
    printf('<div id="%s-sortables" class="meta-box-sortables">', esc_attr($context));
    // Grab the ones the user has manually sorted.
    // Pull them out of their previous context/priority and into the one the user chose.
    $sorted = get_user_option("meta-box-order_{$page}");
    if (!$already_sorted && $sorted) {
        foreach ($sorted as $box_context => $ids) {
            foreach (explode(',', $ids) as $id) {
                if ($id && 'dashboard_browser_nag' !== $id) {
                    add_meta_box($id, null, null, $screen, $box_context, 'sorted');
                }
            }
        }
    }
    $already_sorted = true;
    $i = 0;
    if (isset($wp_meta_boxes[$page][$context])) {
        foreach (array('high', 'sorted', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ((array) $wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false === $box || !$box['title']) {
                        continue;
                    }
                    $block_compatible = true;
                    if (is_array($box['args'])) {
                        // If a meta box is just here for back compat, don't show it in the block editor.
                        if ($screen->is_block_editor() && isset($box['args']['__back_compat_meta_box']) && $box['args']['__back_compat_meta_box']) {
                            continue;
                        }
                        if (isset($box['args']['__block_editor_compatible_meta_box'])) {
                            $block_compatible = (bool) $box['args']['__block_editor_compatible_meta_box'];
                            unset($box['args']['__block_editor_compatible_meta_box']);
                        }
                        // If the meta box is declared as incompatible with the block editor, override the callback function.
                        if (!$block_compatible && $screen->is_block_editor()) {
                            $box['old_callback'] = $box['callback'];
                            $box['callback'] = 'do_block_editor_incompatible_meta_box';
                        }
                        if (isset($box['args']['__back_compat_meta_box'])) {
                            $block_compatible = $block_compatible || (bool) $box['args']['__back_compat_meta_box'];
                            unset($box['args']['__back_compat_meta_box']);
                        }
                    }
                    $i++;
                    // get_hidden_meta_boxes() doesn't apply in the block editor.
                    $hidden_class = (!$screen->is_block_editor() && in_array($box['id'], $hidden, true)) ? ' hide-if-js' : '';
                    echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
                    echo '<div class="postbox-header">';
                    echo '<h2 class="hndle">';
                    if ('dashboard_php_nag' === $box['id']) {
                        echo '<span aria-hidden="true" class="dashicons dashicons-warning"></span>';
                        echo '<span class="screen-reader-text">' . __('Warning:') . ' </span>';
                    }
                    echo $box['title'];
                    echo "</h2>\n";
                    if ('dashboard_browser_nag' !== $box['id']) {
                        $widget_title = $box['title'];
                        if (is_array($box['args']) && isset($box['args']['__widget_basename'])) {
                            $widget_title = $box['args']['__widget_basename'];
                            // Do not pass this parameter to the user callback function.
                            unset($box['args']['__widget_basename']);
                        }
                        echo '<div class="handle-actions hide-if-no-js">';
                        echo '<button type="button" class="handle-order-higher" aria-disabled="false" aria-describedby="' . $box['id'] . '-handle-order-higher-description">';
                        echo '<span class="screen-reader-text">' . __('Move up') . '</span>';
                        echo '<span class="order-higher-indicator" aria-hidden="true"></span>';
                        echo '</button>';
                        echo '<span class="hidden" id="' . $box['id'] . '-handle-order-higher-description">' . sprintf(
                            /* translators: %s: Meta box title. */
                            __('Move %s box up'),
                            $widget_title
                        ) . '</span>';
                        echo '<button type="button" class="handle-order-lower" aria-disabled="false" aria-describedby="' . $box['id'] . '-handle-order-lower-description">';
                        echo '<span class="screen-reader-text">' . __('Move down') . '</span>';
                        echo '<span class="order-lower-indicator" aria-hidden="true"></span>';
                        echo '</button>';
                        echo '<span class="hidden" id="' . $box['id'] . '-handle-order-lower-description">' . sprintf(
                            /* translators: %s: Meta box title. */
                            __('Move %s box down'),
                            $widget_title
                        ) . '</span>';
                        echo '<button type="button" class="handlediv" aria-expanded="true">';
                        echo '<span class="screen-reader-text">' . sprintf(
                            /* translators: %s: Hidden accessibility text. Meta box title. */
                            __('Toggle panel: %s'),
                            $widget_title
                        ) . '</span>';
                        echo '<span class="toggle-indicator" aria-hidden="true"></span>';
                        echo '</button>';
                        echo '</div>';
                    }
                    echo '</div>';
                    echo '<div class="inside">' . "\n";
                    if (WP_DEBUG && !$block_compatible && 'edit' === $screen->parent_base && !$screen->is_block_editor() && !isset($_GET['meta-box-loader'])) {
                        $plugin = _get_plugin_from_callback($box['callback']);
                        if ($plugin) {
                            ?>
							<div class="error inline">
								<p>
									<?php 
                            /* translators: %s: The name of the plugin that generated this meta box. */
                            printf(__('This meta box, from the %s plugin, is not compatible with the block editor.'), "<strong>{$plugin['Name']}</strong>");
                            ?>
								</p>
							</div>
							<?php 
                        }
                    }
                    call_user_func($box['callback'], $data_object, $box);
                    echo "</div>\n";
                    echo "</div>\n";
                }
            }
        }
    }
    echo '</div>';
    return $i;
}

WordPress Version: 6.1

/**
 * Meta-Box template function.
 *
 * @since 2.5.0
 *
 * @global array $wp_meta_boxes
 *
 * @param string|WP_Screen $screen      The screen identifier. If you have used add_menu_page() or
 *                                      add_submenu_page() to create a new screen (and hence screen_id)
 *                                      make sure your menu slug conforms to the limits of sanitize_key()
 *                                      otherwise the 'screen' menu may not correctly render on your page.
 * @param string           $context     The screen context for which to display meta boxes.
 * @param mixed            $data_object Gets passed to the meta box callback function as the first parameter.
 *                                      Often this is the object that's the focus of the current screen,
 *                                      for example a `WP_Post` or `WP_Comment` object.
 * @return int Number of meta_boxes.
 */
function do_meta_boxes($screen, $context, $data_object)
{
    global $wp_meta_boxes;
    static $already_sorted = false;
    if (empty($screen)) {
        $screen = get_current_screen();
    } elseif (is_string($screen)) {
        $screen = convert_to_screen($screen);
    }
    $page = $screen->id;
    $hidden = get_hidden_meta_boxes($screen);
    printf('<div id="%s-sortables" class="meta-box-sortables">', esc_attr($context));
    // Grab the ones the user has manually sorted.
    // Pull them out of their previous context/priority and into the one the user chose.
    $sorted = get_user_option("meta-box-order_{$page}");
    if (!$already_sorted && $sorted) {
        foreach ($sorted as $box_context => $ids) {
            foreach (explode(',', $ids) as $id) {
                if ($id && 'dashboard_browser_nag' !== $id) {
                    add_meta_box($id, null, null, $screen, $box_context, 'sorted');
                }
            }
        }
    }
    $already_sorted = true;
    $i = 0;
    if (isset($wp_meta_boxes[$page][$context])) {
        foreach (array('high', 'sorted', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ((array) $wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false === $box || !$box['title']) {
                        continue;
                    }
                    $block_compatible = true;
                    if (is_array($box['args'])) {
                        // If a meta box is just here for back compat, don't show it in the block editor.
                        if ($screen->is_block_editor() && isset($box['args']['__back_compat_meta_box']) && $box['args']['__back_compat_meta_box']) {
                            continue;
                        }
                        if (isset($box['args']['__block_editor_compatible_meta_box'])) {
                            $block_compatible = (bool) $box['args']['__block_editor_compatible_meta_box'];
                            unset($box['args']['__block_editor_compatible_meta_box']);
                        }
                        // If the meta box is declared as incompatible with the block editor, override the callback function.
                        if (!$block_compatible && $screen->is_block_editor()) {
                            $box['old_callback'] = $box['callback'];
                            $box['callback'] = 'do_block_editor_incompatible_meta_box';
                        }
                        if (isset($box['args']['__back_compat_meta_box'])) {
                            $block_compatible = $block_compatible || (bool) $box['args']['__back_compat_meta_box'];
                            unset($box['args']['__back_compat_meta_box']);
                        }
                    }
                    $i++;
                    // get_hidden_meta_boxes() doesn't apply in the block editor.
                    $hidden_class = (!$screen->is_block_editor() && in_array($box['id'], $hidden, true)) ? ' hide-if-js' : '';
                    echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
                    echo '<div class="postbox-header">';
                    echo '<h2 class="hndle">';
                    if ('dashboard_php_nag' === $box['id']) {
                        echo '<span aria-hidden="true" class="dashicons dashicons-warning"></span>';
                        echo '<span class="screen-reader-text">' . __('Warning:') . ' </span>';
                    }
                    echo $box['title'];
                    echo "</h2>\n";
                    if ('dashboard_browser_nag' !== $box['id']) {
                        $widget_title = $box['title'];
                        if (is_array($box['args']) && isset($box['args']['__widget_basename'])) {
                            $widget_title = $box['args']['__widget_basename'];
                            // Do not pass this parameter to the user callback function.
                            unset($box['args']['__widget_basename']);
                        }
                        echo '<div class="handle-actions hide-if-no-js">';
                        echo '<button type="button" class="handle-order-higher" aria-disabled="false" aria-describedby="' . $box['id'] . '-handle-order-higher-description">';
                        echo '<span class="screen-reader-text">' . __('Move up') . '</span>';
                        echo '<span class="order-higher-indicator" aria-hidden="true"></span>';
                        echo '</button>';
                        echo '<span class="hidden" id="' . $box['id'] . '-handle-order-higher-description">' . sprintf(
                            /* translators: %s: Meta box title. */
                            __('Move %s box up'),
                            $widget_title
                        ) . '</span>';
                        echo '<button type="button" class="handle-order-lower" aria-disabled="false" aria-describedby="' . $box['id'] . '-handle-order-lower-description">';
                        echo '<span class="screen-reader-text">' . __('Move down') . '</span>';
                        echo '<span class="order-lower-indicator" aria-hidden="true"></span>';
                        echo '</button>';
                        echo '<span class="hidden" id="' . $box['id'] . '-handle-order-lower-description">' . sprintf(
                            /* translators: %s: Meta box title. */
                            __('Move %s box down'),
                            $widget_title
                        ) . '</span>';
                        echo '<button type="button" class="handlediv" aria-expanded="true">';
                        echo '<span class="screen-reader-text">' . sprintf(
                            /* translators: %s: Meta box title. */
                            __('Toggle panel: %s'),
                            $widget_title
                        ) . '</span>';
                        echo '<span class="toggle-indicator" aria-hidden="true"></span>';
                        echo '</button>';
                        echo '</div>';
                    }
                    echo '</div>';
                    echo '<div class="inside">' . "\n";
                    if (WP_DEBUG && !$block_compatible && 'edit' === $screen->parent_base && !$screen->is_block_editor() && !isset($_GET['meta-box-loader'])) {
                        $plugin = _get_plugin_from_callback($box['callback']);
                        if ($plugin) {
                            ?>
							<div class="error inline">
								<p>
									<?php 
                            /* translators: %s: The name of the plugin that generated this meta box. */
                            printf(__('This meta box, from the %s plugin, is not compatible with the block editor.'), "<strong>{$plugin['Name']}</strong>");
                            ?>
								</p>
							</div>
							<?php 
                        }
                    }
                    call_user_func($box['callback'], $data_object, $box);
                    echo "</div>\n";
                    echo "</div>\n";
                }
            }
        }
    }
    echo '</div>';
    return $i;
}

WordPress Version: 5.6

/**
 * Meta-Box template function.
 *
 * @since 2.5.0
 *
 * @global array $wp_meta_boxes
 *
 * @param string|WP_Screen $screen  The screen identifier. If you have used add_menu_page() or
 *                                  add_submenu_page() to create a new screen (and hence screen_id)
 *                                  make sure your menu slug conforms to the limits of sanitize_key()
 *                                  otherwise the 'screen' menu may not correctly render on your page.
 * @param string           $context The screen context for which to display meta boxes.
 * @param mixed            $object  Gets passed to the meta box callback function as the first parameter.
 *                                  Often this is the object that's the focus of the current screen, for
 *                                  example a `WP_Post` or `WP_Comment` object.
 * @return int Number of meta_boxes.
 */
function do_meta_boxes($screen, $context, $object)
{
    global $wp_meta_boxes;
    static $already_sorted = false;
    if (empty($screen)) {
        $screen = get_current_screen();
    } elseif (is_string($screen)) {
        $screen = convert_to_screen($screen);
    }
    $page = $screen->id;
    $hidden = get_hidden_meta_boxes($screen);
    printf('<div id="%s-sortables" class="meta-box-sortables">', esc_attr($context));
    // Grab the ones the user has manually sorted.
    // Pull them out of their previous context/priority and into the one the user chose.
    $sorted = get_user_option("meta-box-order_{$page}");
    if (!$already_sorted && $sorted) {
        foreach ($sorted as $box_context => $ids) {
            foreach (explode(',', $ids) as $id) {
                if ($id && 'dashboard_browser_nag' !== $id) {
                    add_meta_box($id, null, null, $screen, $box_context, 'sorted');
                }
            }
        }
    }
    $already_sorted = true;
    $i = 0;
    if (isset($wp_meta_boxes[$page][$context])) {
        foreach (array('high', 'sorted', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ((array) $wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false === $box || !$box['title']) {
                        continue;
                    }
                    $block_compatible = true;
                    if (is_array($box['args'])) {
                        // If a meta box is just here for back compat, don't show it in the block editor.
                        if ($screen->is_block_editor() && isset($box['args']['__back_compat_meta_box']) && $box['args']['__back_compat_meta_box']) {
                            continue;
                        }
                        if (isset($box['args']['__block_editor_compatible_meta_box'])) {
                            $block_compatible = (bool) $box['args']['__block_editor_compatible_meta_box'];
                            unset($box['args']['__block_editor_compatible_meta_box']);
                        }
                        // If the meta box is declared as incompatible with the block editor, override the callback function.
                        if (!$block_compatible && $screen->is_block_editor()) {
                            $box['old_callback'] = $box['callback'];
                            $box['callback'] = 'do_block_editor_incompatible_meta_box';
                        }
                        if (isset($box['args']['__back_compat_meta_box'])) {
                            $block_compatible = $block_compatible || (bool) $box['args']['__back_compat_meta_box'];
                            unset($box['args']['__back_compat_meta_box']);
                        }
                    }
                    $i++;
                    // get_hidden_meta_boxes() doesn't apply in the block editor.
                    $hidden_class = (!$screen->is_block_editor() && in_array($box['id'], $hidden, true)) ? ' hide-if-js' : '';
                    echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
                    echo '<div class="postbox-header">';
                    echo '<h2 class="hndle">';
                    if ('dashboard_php_nag' === $box['id']) {
                        echo '<span aria-hidden="true" class="dashicons dashicons-warning"></span>';
                        echo '<span class="screen-reader-text">' . __('Warning:') . ' </span>';
                    }
                    echo $box['title'];
                    echo "</h2>\n";
                    if ('dashboard_browser_nag' !== $box['id']) {
                        $widget_title = $box['title'];
                        if (is_array($box['args']) && isset($box['args']['__widget_basename'])) {
                            $widget_title = $box['args']['__widget_basename'];
                            // Do not pass this parameter to the user callback function.
                            unset($box['args']['__widget_basename']);
                        }
                        echo '<div class="handle-actions hide-if-no-js">';
                        echo '<button type="button" class="handle-order-higher" aria-disabled="false" aria-describedby="' . $box['id'] . '-handle-order-higher-description">';
                        echo '<span class="screen-reader-text">' . __('Move up') . '</span>';
                        echo '<span class="order-higher-indicator" aria-hidden="true"></span>';
                        echo '</button>';
                        echo '<span class="hidden" id="' . $box['id'] . '-handle-order-higher-description">' . sprintf(
                            /* translators: %s: Meta box title. */
                            __('Move %s box up'),
                            $widget_title
                        ) . '</span>';
                        echo '<button type="button" class="handle-order-lower" aria-disabled="false" aria-describedby="' . $box['id'] . '-handle-order-lower-description">';
                        echo '<span class="screen-reader-text">' . __('Move down') . '</span>';
                        echo '<span class="order-lower-indicator" aria-hidden="true"></span>';
                        echo '</button>';
                        echo '<span class="hidden" id="' . $box['id'] . '-handle-order-lower-description">' . sprintf(
                            /* translators: %s: Meta box title. */
                            __('Move %s box down'),
                            $widget_title
                        ) . '</span>';
                        echo '<button type="button" class="handlediv" aria-expanded="true">';
                        echo '<span class="screen-reader-text">' . sprintf(
                            /* translators: %s: Meta box title. */
                            __('Toggle panel: %s'),
                            $widget_title
                        ) . '</span>';
                        echo '<span class="toggle-indicator" aria-hidden="true"></span>';
                        echo '</button>';
                        echo '</div>';
                    }
                    echo '</div>';
                    echo '<div class="inside">' . "\n";
                    if (WP_DEBUG && !$block_compatible && 'edit' === $screen->parent_base && !$screen->is_block_editor() && !isset($_GET['meta-box-loader'])) {
                        $plugin = _get_plugin_from_callback($box['callback']);
                        if ($plugin) {
                            ?>
							<div class="error inline">
								<p>
									<?php 
                            /* translators: %s: The name of the plugin that generated this meta box. */
                            printf(__("This meta box, from the %s plugin, isn't compatible with the block editor."), "<strong>{$plugin['Name']}</strong>");
                            ?>
								</p>
							</div>
							<?php 
                        }
                    }
                    call_user_func($box['callback'], $object, $box);
                    echo "</div>\n";
                    echo "</div>\n";
                }
            }
        }
    }
    echo '</div>';
    return $i;
}

WordPress Version: 5.5

/**
 * Meta-Box template function.
 *
 * @since 2.5.0
 *
 * @global array $wp_meta_boxes
 *
 * @param string|WP_Screen $screen  The screen identifier. If you have used add_menu_page() or
 *                                  add_submenu_page() to create a new screen (and hence screen_id)
 *                                  make sure your menu slug conforms to the limits of sanitize_key()
 *                                  otherwise the 'screen' menu may not correctly render on your page.
 * @param string           $context The screen context for which to display meta boxes.
 * @param mixed            $object  Gets passed to the meta box callback function as the first parameter.
 *                                  Often this is the object that's the focus of the current screen, for
 *                                  example a `WP_Post` or `WP_Comment` object.
 * @return int Number of meta_boxes.
 */
function do_meta_boxes($screen, $context, $object)
{
    global $wp_meta_boxes;
    static $already_sorted = false;
    if (empty($screen)) {
        $screen = get_current_screen();
    } elseif (is_string($screen)) {
        $screen = convert_to_screen($screen);
    }
    $page = $screen->id;
    $hidden = get_hidden_meta_boxes($screen);
    printf('<div id="%s-sortables" class="meta-box-sortables">', esc_attr($context));
    // Grab the ones the user has manually sorted.
    // Pull them out of their previous context/priority and into the one the user chose.
    $sorted = get_user_option("meta-box-order_{$page}");
    if (!$already_sorted && $sorted) {
        foreach ($sorted as $box_context => $ids) {
            foreach (explode(',', $ids) as $id) {
                if ($id && 'dashboard_browser_nag' !== $id) {
                    add_meta_box($id, null, null, $screen, $box_context, 'sorted');
                }
            }
        }
    }
    $already_sorted = true;
    $i = 0;
    if (isset($wp_meta_boxes[$page][$context])) {
        foreach (array('high', 'sorted', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ((array) $wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false === $box || !$box['title']) {
                        continue;
                    }
                    $block_compatible = true;
                    if (is_array($box['args'])) {
                        // If a meta box is just here for back compat, don't show it in the block editor.
                        if ($screen->is_block_editor() && isset($box['args']['__back_compat_meta_box']) && $box['args']['__back_compat_meta_box']) {
                            continue;
                        }
                        if (isset($box['args']['__block_editor_compatible_meta_box'])) {
                            $block_compatible = (bool) $box['args']['__block_editor_compatible_meta_box'];
                            unset($box['args']['__block_editor_compatible_meta_box']);
                        }
                        // If the meta box is declared as incompatible with the block editor, override the callback function.
                        if (!$block_compatible && $screen->is_block_editor()) {
                            $box['old_callback'] = $box['callback'];
                            $box['callback'] = 'do_block_editor_incompatible_meta_box';
                        }
                        if (isset($box['args']['__back_compat_meta_box'])) {
                            $block_compatible = $block_compatible || (bool) $box['args']['__back_compat_meta_box'];
                            unset($box['args']['__back_compat_meta_box']);
                        }
                    }
                    $i++;
                    // get_hidden_meta_boxes() doesn't apply in the block editor.
                    $hidden_class = (!$screen->is_block_editor() && in_array($box['id'], $hidden, true)) ? ' hide-if-js' : '';
                    echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
                    echo '<div class="postbox-header">';
                    echo '<h2 class="hndle">';
                    if ('dashboard_php_nag' === $box['id']) {
                        echo '<span aria-hidden="true" class="dashicons dashicons-warning"></span>';
                        echo '<span class="screen-reader-text">' . __('Warning:') . ' </span>';
                    }
                    echo "{$box['title']}";
                    echo "</h2>\n";
                    if ('dashboard_browser_nag' !== $box['id']) {
                        $widget_title = $box['title'];
                        if (is_array($box['args']) && isset($box['args']['__widget_basename'])) {
                            $widget_title = $box['args']['__widget_basename'];
                            // Do not pass this parameter to the user callback function.
                            unset($box['args']['__widget_basename']);
                        }
                        echo '<div class="handle-actions hide-if-no-js">';
                        echo '<button type="button" class="handle-order-higher" aria-disabled="false" aria-describedby="' . $box['id'] . '-handle-order-higher-description">';
                        echo '<span class="screen-reader-text">' . __('Move up') . '</span>';
                        echo '<span class="order-higher-indicator" aria-hidden="true"></span>';
                        echo '</button>';
                        echo '<span class="hidden" id="' . $box['id'] . '-handle-order-higher-description">' . sprintf(
                            /* translators: %s: Meta box title. */
                            __('Move %s box up'),
                            $widget_title
                        ) . '</span>';
                        echo '<button type="button" class="handle-order-lower" aria-disabled="false" aria-describedby="' . $box['id'] . '-handle-order-lower-description">';
                        echo '<span class="screen-reader-text">' . __('Move down') . '</span>';
                        echo '<span class="order-lower-indicator" aria-hidden="true"></span>';
                        echo '</button>';
                        echo '<span class="hidden" id="' . $box['id'] . '-handle-order-lower-description">' . sprintf(
                            /* translators: %s: Meta box title. */
                            __('Move %s box down'),
                            $widget_title
                        ) . '</span>';
                        echo '<button type="button" class="handlediv" aria-expanded="true">';
                        echo '<span class="screen-reader-text">' . sprintf(
                            /* translators: %s: Meta box title. */
                            __('Toggle panel: %s'),
                            $widget_title
                        ) . '</span>';
                        echo '<span class="toggle-indicator" aria-hidden="true"></span>';
                        echo '</button>';
                        echo '</div>';
                    }
                    echo '</div>';
                    echo '<div class="inside">' . "\n";
                    if (WP_DEBUG && !$block_compatible && 'edit' === $screen->parent_base && !$screen->is_block_editor() && !isset($_GET['meta-box-loader'])) {
                        $plugin = _get_plugin_from_callback($box['callback']);
                        if ($plugin) {
                            ?>
							<div class="error inline">
								<p>
									<?php 
                            /* translators: %s: The name of the plugin that generated this meta box. */
                            printf(__("This meta box, from the %s plugin, isn't compatible with the block editor."), "<strong>{$plugin['Name']}</strong>");
                            ?>
								</p>
							</div>
							<?php 
                        }
                    }
                    call_user_func($box['callback'], $object, $box);
                    echo "</div>\n";
                    echo "</div>\n";
                }
            }
        }
    }
    echo '</div>';
    return $i;
}

WordPress Version: 5.4

/**
 * Meta-Box template function.
 *
 * @since 2.5.0
 *
 * @global array $wp_meta_boxes
 *
 * @staticvar bool $already_sorted
 *
 * @param string|WP_Screen $screen  Screen identifier. If you have used add_menu_page() or
 *                                  add_submenu_page() to create a new screen (and hence screen_id)
 *                                  make sure your menu slug conforms to the limits of sanitize_key()
 *                                  otherwise the 'screen' menu may not correctly render on your page.
 * @param string           $context The screen context for which to display meta boxes.
 * @param mixed            $object  Gets passed to the first parameter of the meta box callback function.
 *                                  Often this is the object that's the focus of the current screen, for
 *                                  example a `WP_Post` or `WP_Comment` object.
 * @return int number of meta_boxes
 */
function do_meta_boxes($screen, $context, $object)
{
    global $wp_meta_boxes;
    static $already_sorted = false;
    if (empty($screen)) {
        $screen = get_current_screen();
    } elseif (is_string($screen)) {
        $screen = convert_to_screen($screen);
    }
    $page = $screen->id;
    $hidden = get_hidden_meta_boxes($screen);
    printf('<div id="%s-sortables" class="meta-box-sortables">', esc_attr($context));
    // Grab the ones the user has manually sorted.
    // Pull them out of their previous context/priority and into the one the user chose.
    $sorted = get_user_option("meta-box-order_{$page}");
    if (!$already_sorted && $sorted) {
        foreach ($sorted as $box_context => $ids) {
            foreach (explode(',', $ids) as $id) {
                if ($id && 'dashboard_browser_nag' !== $id) {
                    add_meta_box($id, null, null, $screen, $box_context, 'sorted');
                }
            }
        }
    }
    $already_sorted = true;
    $i = 0;
    if (isset($wp_meta_boxes[$page][$context])) {
        foreach (array('high', 'sorted', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ((array) $wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false == $box || !$box['title']) {
                        continue;
                    }
                    $block_compatible = true;
                    if (is_array($box['args'])) {
                        // If a meta box is just here for back compat, don't show it in the block editor.
                        if ($screen->is_block_editor() && isset($box['args']['__back_compat_meta_box']) && $box['args']['__back_compat_meta_box']) {
                            continue;
                        }
                        if (isset($box['args']['__block_editor_compatible_meta_box'])) {
                            $block_compatible = (bool) $box['args']['__block_editor_compatible_meta_box'];
                            unset($box['args']['__block_editor_compatible_meta_box']);
                        }
                        // If the meta box is declared as incompatible with the block editor, override the callback function.
                        if (!$block_compatible && $screen->is_block_editor()) {
                            $box['old_callback'] = $box['callback'];
                            $box['callback'] = 'do_block_editor_incompatible_meta_box';
                        }
                        if (isset($box['args']['__back_compat_meta_box'])) {
                            $block_compatible = $block_compatible || (bool) $box['args']['__back_compat_meta_box'];
                            unset($box['args']['__back_compat_meta_box']);
                        }
                    }
                    $i++;
                    // get_hidden_meta_boxes() doesn't apply in the block editor.
                    $hidden_class = (!$screen->is_block_editor() && in_array($box['id'], $hidden)) ? ' hide-if-js' : '';
                    echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
                    if ('dashboard_browser_nag' != $box['id']) {
                        $widget_title = $box['title'];
                        if (is_array($box['args']) && isset($box['args']['__widget_basename'])) {
                            $widget_title = $box['args']['__widget_basename'];
                            // Do not pass this parameter to the user callback function.
                            unset($box['args']['__widget_basename']);
                        }
                        echo '<button type="button" class="handlediv" aria-expanded="true">';
                        echo '<span class="screen-reader-text">' . sprintf(
                            /* translators: %s: Meta box title. */
                            __('Toggle panel: %s'),
                            $widget_title
                        ) . '</span>';
                        echo '<span class="toggle-indicator" aria-hidden="true"></span>';
                        echo '</button>';
                    }
                    echo '<h2 class="hndle">';
                    if ('dashboard_php_nag' === $box['id']) {
                        echo '<span aria-hidden="true" class="dashicons dashicons-warning"></span>';
                        echo '<span class="screen-reader-text">' . __('Warning:') . ' </span>';
                    }
                    echo "<span>{$box['title']}</span>";
                    echo "</h2>\n";
                    echo '<div class="inside">' . "\n";
                    if (WP_DEBUG && !$block_compatible && 'edit' === $screen->parent_base && !$screen->is_block_editor() && !isset($_GET['meta-box-loader'])) {
                        $plugin = _get_plugin_from_callback($box['callback']);
                        if ($plugin) {
                            ?>
							<div class="error inline">
								<p>
									<?php 
                            /* translators: %s: The name of the plugin that generated this meta box. */
                            printf(__("This meta box, from the %s plugin, isn't compatible with the block editor."), "<strong>{$plugin['Name']}</strong>");
                            ?>
								</p>
							</div>
							<?php 
                        }
                    }
                    call_user_func($box['callback'], $object, $box);
                    echo "</div>\n";
                    echo "</div>\n";
                }
            }
        }
    }
    echo '</div>';
    return $i;
}

WordPress Version: 5.3

/**
 * Meta-Box template function.
 *
 * @since 2.5.0
 *
 * @global array $wp_meta_boxes
 *
 * @staticvar bool $already_sorted
 *
 * @param string|WP_Screen $screen  Screen identifier. If you have used add_menu_page() or
 *                                  add_submenu_page() to create a new screen (and hence screen_id)
 *                                  make sure your menu slug conforms to the limits of sanitize_key()
 *                                  otherwise the 'screen' menu may not correctly render on your page.
 * @param string           $context The screen context for which to display meta boxes.
 * @param mixed            $object  Gets passed to the first parameter of the meta box callback function.
 *                                  Often this is the object that's the focus of the current screen, for
 *                                  example a `WP_Post` or `WP_Comment` object.
 * @return int number of meta_boxes
 */
function do_meta_boxes($screen, $context, $object)
{
    global $wp_meta_boxes;
    static $already_sorted = false;
    if (empty($screen)) {
        $screen = get_current_screen();
    } elseif (is_string($screen)) {
        $screen = convert_to_screen($screen);
    }
    $page = $screen->id;
    $hidden = get_hidden_meta_boxes($screen);
    printf('<div id="%s-sortables" class="meta-box-sortables">', esc_attr($context));
    // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
    $sorted = get_user_option("meta-box-order_{$page}");
    if (!$already_sorted && $sorted) {
        foreach ($sorted as $box_context => $ids) {
            foreach (explode(',', $ids) as $id) {
                if ($id && 'dashboard_browser_nag' !== $id) {
                    add_meta_box($id, null, null, $screen, $box_context, 'sorted');
                }
            }
        }
    }
    $already_sorted = true;
    $i = 0;
    if (isset($wp_meta_boxes[$page][$context])) {
        foreach (array('high', 'sorted', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ((array) $wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false == $box || !$box['title']) {
                        continue;
                    }
                    $block_compatible = true;
                    if (is_array($box['args'])) {
                        // If a meta box is just here for back compat, don't show it in the block editor.
                        if ($screen->is_block_editor() && isset($box['args']['__back_compat_meta_box']) && $box['args']['__back_compat_meta_box']) {
                            continue;
                        }
                        if (isset($box['args']['__block_editor_compatible_meta_box'])) {
                            $block_compatible = (bool) $box['args']['__block_editor_compatible_meta_box'];
                            unset($box['args']['__block_editor_compatible_meta_box']);
                        }
                        // If the meta box is declared as incompatible with the block editor, override the callback function.
                        if (!$block_compatible && $screen->is_block_editor()) {
                            $box['old_callback'] = $box['callback'];
                            $box['callback'] = 'do_block_editor_incompatible_meta_box';
                        }
                        if (isset($box['args']['__back_compat_meta_box'])) {
                            $block_compatible = $block_compatible || (bool) $box['args']['__back_compat_meta_box'];
                            unset($box['args']['__back_compat_meta_box']);
                        }
                    }
                    $i++;
                    // get_hidden_meta_boxes() doesn't apply in the block editor.
                    $hidden_class = (!$screen->is_block_editor() && in_array($box['id'], $hidden)) ? ' hide-if-js' : '';
                    echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
                    if ('dashboard_browser_nag' != $box['id']) {
                        $widget_title = $box['title'];
                        if (is_array($box['args']) && isset($box['args']['__widget_basename'])) {
                            $widget_title = $box['args']['__widget_basename'];
                            // Do not pass this parameter to the user callback function.
                            unset($box['args']['__widget_basename']);
                        }
                        echo '<button type="button" class="handlediv" aria-expanded="true">';
                        echo '<span class="screen-reader-text">' . sprintf(
                            /* translators: Meta box title. */
                            __('Toggle panel: %s'),
                            $widget_title
                        ) . '</span>';
                        echo '<span class="toggle-indicator" aria-hidden="true"></span>';
                        echo '</button>';
                    }
                    echo '<h2 class="hndle">';
                    if ('dashboard_php_nag' === $box['id']) {
                        echo '<span aria-hidden="true" class="dashicons dashicons-warning"></span>';
                        echo '<span class="screen-reader-text">' . __('Warning:') . ' </span>';
                    }
                    echo "<span>{$box['title']}</span>";
                    echo "</h2>\n";
                    echo '<div class="inside">' . "\n";
                    if (WP_DEBUG && !$block_compatible && 'edit' === $screen->parent_base && !$screen->is_block_editor() && !isset($_GET['meta-box-loader'])) {
                        $plugin = _get_plugin_from_callback($box['callback']);
                        if ($plugin) {
                            ?>
							<div class="error inline">
								<p>
									<?php 
                            /* translators: %s: The name of the plugin that generated this meta box. */
                            printf(__("This meta box, from the %s plugin, isn't compatible with the block editor."), "<strong>{$plugin['Name']}</strong>");
                            ?>
								</p>
							</div>
							<?php 
                        }
                    }
                    call_user_func($box['callback'], $object, $box);
                    echo "</div>\n";
                    echo "</div>\n";
                }
            }
        }
    }
    echo '</div>';
    return $i;
}

WordPress Version: 5.1

/**
 * Meta-Box template function.
 *
 * @since 2.5.0
 *
 * @global array $wp_meta_boxes
 *
 * @staticvar bool $already_sorted
 *
 * @param string|WP_Screen $screen  Screen identifier. If you have used add_menu_page() or
 *                                  add_submenu_page() to create a new screen (and hence screen_id)
 *                                  make sure your menu slug conforms to the limits of sanitize_key()
 *                                  otherwise the 'screen' menu may not correctly render on your page.
 * @param string           $context The screen context for which to display meta boxes.
 * @param mixed            $object  Gets passed to the first parameter of the meta box callback function.
 *                                  Often this is the object that's the focus of the current screen, for
 *                                  example a `WP_Post` or `WP_Comment` object.
 * @return int number of meta_boxes
 */
function do_meta_boxes($screen, $context, $object)
{
    global $wp_meta_boxes;
    static $already_sorted = false;
    if (empty($screen)) {
        $screen = get_current_screen();
    } elseif (is_string($screen)) {
        $screen = convert_to_screen($screen);
    }
    $page = $screen->id;
    $hidden = get_hidden_meta_boxes($screen);
    printf('<div id="%s-sortables" class="meta-box-sortables">', esc_attr($context));
    // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
    if (!$already_sorted && $sorted = get_user_option("meta-box-order_{$page}")) {
        foreach ($sorted as $box_context => $ids) {
            foreach (explode(',', $ids) as $id) {
                if ($id && 'dashboard_browser_nag' !== $id) {
                    add_meta_box($id, null, null, $screen, $box_context, 'sorted');
                }
            }
        }
    }
    $already_sorted = true;
    $i = 0;
    if (isset($wp_meta_boxes[$page][$context])) {
        foreach (array('high', 'sorted', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ((array) $wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false == $box || !$box['title']) {
                        continue;
                    }
                    $block_compatible = true;
                    if (is_array($box['args'])) {
                        // If a meta box is just here for back compat, don't show it in the block editor.
                        if ($screen->is_block_editor() && isset($box['args']['__back_compat_meta_box']) && $box['args']['__back_compat_meta_box']) {
                            continue;
                        }
                        if (isset($box['args']['__block_editor_compatible_meta_box'])) {
                            $block_compatible = (bool) $box['args']['__block_editor_compatible_meta_box'];
                            unset($box['args']['__block_editor_compatible_meta_box']);
                        }
                        // If the meta box is declared as incompatible with the block editor, override the callback function.
                        if (!$block_compatible && $screen->is_block_editor()) {
                            $box['old_callback'] = $box['callback'];
                            $box['callback'] = 'do_block_editor_incompatible_meta_box';
                        }
                        if (isset($box['args']['__back_compat_meta_box'])) {
                            $block_compatible = $block_compatible || (bool) $box['args']['__back_compat_meta_box'];
                            unset($box['args']['__back_compat_meta_box']);
                        }
                    }
                    $i++;
                    // get_hidden_meta_boxes() doesn't apply in the block editor.
                    $hidden_class = (!$screen->is_block_editor() && in_array($box['id'], $hidden)) ? ' hide-if-js' : '';
                    echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
                    if ('dashboard_browser_nag' != $box['id']) {
                        $widget_title = $box['title'];
                        if (is_array($box['args']) && isset($box['args']['__widget_basename'])) {
                            $widget_title = $box['args']['__widget_basename'];
                            // Do not pass this parameter to the user callback function.
                            unset($box['args']['__widget_basename']);
                        }
                        echo '<button type="button" class="handlediv" aria-expanded="true">';
                        echo '<span class="screen-reader-text">' . sprintf(__('Toggle panel: %s'), $widget_title) . '</span>';
                        echo '<span class="toggle-indicator" aria-hidden="true"></span>';
                        echo '</button>';
                    }
                    echo '<h2 class="hndle">';
                    if ('dashboard_php_nag' === $box['id']) {
                        echo '<span aria-hidden="true" class="dashicons dashicons-warning"></span>';
                        echo '<span class="screen-reader-text">' . __('Warning:') . ' </span>';
                    }
                    echo "<span>{$box['title']}</span>";
                    echo "</h2>\n";
                    echo '<div class="inside">' . "\n";
                    if (WP_DEBUG && !$block_compatible && 'edit' === $screen->parent_base && !$screen->is_block_editor() && !isset($_GET['meta-box-loader'])) {
                        $plugin = _get_plugin_from_callback($box['callback']);
                        if ($plugin) {
                            ?>
							<div class="error inline">
								<p>
									<?php 
                            /* translators: %s: the name of the plugin that generated this meta box. */
                            printf(__("This meta box, from the %s plugin, isn't compatible with the block editor."), "<strong>{$plugin['Name']}</strong>");
                            ?>
								</p>
							</div>
							<?php 
                        }
                    }
                    call_user_func($box['callback'], $object, $box);
                    echo "</div>\n";
                    echo "</div>\n";
                }
            }
        }
    }
    echo '</div>';
    return $i;
}

WordPress Version: 5.0

/**
 * Meta-Box template function
 *
 * @since 2.5.0
 *
 * @global array $wp_meta_boxes
 *
 * @staticvar bool $already_sorted
 *
 * @param string|WP_Screen $screen  Screen identifier. If you have used add_menu_page() or
 *                                  add_submenu_page() to create a new screen (and hence screen_id)
 *                                  make sure your menu slug conforms to the limits of sanitize_key()
 *                                  otherwise the 'screen' menu may not correctly render on your page.
 * @param string           $context box context
 * @param mixed            $object  gets passed to the box callback function as first parameter
 * @return int number of meta_boxes
 */
function do_meta_boxes($screen, $context, $object)
{
    global $wp_meta_boxes;
    static $already_sorted = false;
    if (empty($screen)) {
        $screen = get_current_screen();
    } elseif (is_string($screen)) {
        $screen = convert_to_screen($screen);
    }
    $page = $screen->id;
    $hidden = get_hidden_meta_boxes($screen);
    printf('<div id="%s-sortables" class="meta-box-sortables">', esc_attr($context));
    // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
    if (!$already_sorted && $sorted = get_user_option("meta-box-order_{$page}")) {
        foreach ($sorted as $box_context => $ids) {
            foreach (explode(',', $ids) as $id) {
                if ($id && 'dashboard_browser_nag' !== $id) {
                    add_meta_box($id, null, null, $screen, $box_context, 'sorted');
                }
            }
        }
    }
    $already_sorted = true;
    $i = 0;
    if (isset($wp_meta_boxes[$page][$context])) {
        foreach (array('high', 'sorted', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ((array) $wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false == $box || !$box['title']) {
                        continue;
                    }
                    $block_compatible = true;
                    if (is_array($box['args'])) {
                        // If a meta box is just here for back compat, don't show it in the block editor.
                        if ($screen->is_block_editor() && isset($box['args']['__back_compat_meta_box']) && $box['args']['__back_compat_meta_box']) {
                            continue;
                        }
                        if (isset($box['args']['__block_editor_compatible_meta_box'])) {
                            $block_compatible = (bool) $box['args']['__block_editor_compatible_meta_box'];
                            unset($box['args']['__block_editor_compatible_meta_box']);
                        }
                        // If the meta box is declared as incompatible with the block editor, override the callback function.
                        if (!$block_compatible && $screen->is_block_editor()) {
                            $box['old_callback'] = $box['callback'];
                            $box['callback'] = 'do_block_editor_incompatible_meta_box';
                        }
                        if (isset($box['args']['__back_compat_meta_box'])) {
                            $block_compatible = $block_compatible || (bool) $box['args']['__back_compat_meta_box'];
                            unset($box['args']['__back_compat_meta_box']);
                        }
                    }
                    $i++;
                    // get_hidden_meta_boxes() doesn't apply in the block editor.
                    $hidden_class = (!$screen->is_block_editor() && in_array($box['id'], $hidden)) ? ' hide-if-js' : '';
                    echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
                    if ('dashboard_browser_nag' != $box['id']) {
                        $widget_title = $box['title'];
                        if (is_array($box['args']) && isset($box['args']['__widget_basename'])) {
                            $widget_title = $box['args']['__widget_basename'];
                            // Do not pass this parameter to the user callback function.
                            unset($box['args']['__widget_basename']);
                        }
                        echo '<button type="button" class="handlediv" aria-expanded="true">';
                        echo '<span class="screen-reader-text">' . sprintf(__('Toggle panel: %s'), $widget_title) . '</span>';
                        echo '<span class="toggle-indicator" aria-hidden="true"></span>';
                        echo '</button>';
                    }
                    echo "<h2 class='hndle'><span>{$box['title']}</span></h2>\n";
                    echo '<div class="inside">' . "\n";
                    if (WP_DEBUG && !$block_compatible && 'edit' === $screen->parent_base && !$screen->is_block_editor() && !isset($_GET['meta-box-loader'])) {
                        $plugin = _get_plugin_from_callback($box['callback']);
                        if ($plugin) {
                            ?>
							<div class="error inline">
								<p>
									<?php 
                            /* translators: %s: the name of the plugin that generated this meta box. */
                            printf(__("This meta box, from the %s plugin, isn't compatible with the block editor."), "<strong>{$plugin['Name']}</strong>");
                            ?>
								</p>
							</div>
						<?php 
                        }
                    }
                    call_user_func($box['callback'], $object, $box);
                    echo "</div>\n";
                    echo "</div>\n";
                }
            }
        }
    }
    echo "</div>";
    return $i;
}

WordPress Version: 9.7

/**
 * Meta-Box template function
 *
 * @since 2.5.0
 *
 * @global array $wp_meta_boxes
 *
 * @staticvar bool $already_sorted
 *
 * @param string|WP_Screen $screen  Screen identifier. If you have used add_menu_page() or
 *                                  add_submenu_page() to create a new screen (and hence screen_id)
 *                                  make sure your menu slug conforms to the limits of sanitize_key()
 *                                  otherwise the 'screen' menu may not correctly render on your page.
 * @param string           $context box context
 * @param mixed            $object  gets passed to the box callback function as first parameter
 * @return int number of meta_boxes
 */
function do_meta_boxes($screen, $context, $object)
{
    global $wp_meta_boxes;
    static $already_sorted = false;
    if (empty($screen)) {
        $screen = get_current_screen();
    } elseif (is_string($screen)) {
        $screen = convert_to_screen($screen);
    }
    $page = $screen->id;
    $hidden = get_hidden_meta_boxes($screen);
    printf('<div id="%s-sortables" class="meta-box-sortables">', esc_attr($context));
    // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
    if (!$already_sorted && $sorted = get_user_option("meta-box-order_{$page}")) {
        foreach ($sorted as $box_context => $ids) {
            foreach (explode(',', $ids) as $id) {
                if ($id && 'dashboard_browser_nag' !== $id) {
                    add_meta_box($id, null, null, $screen, $box_context, 'sorted');
                }
            }
        }
    }
    $already_sorted = true;
    $i = 0;
    if (isset($wp_meta_boxes[$page][$context])) {
        foreach (array('high', 'sorted', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ((array) $wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false == $box || !$box['title']) {
                        continue;
                    }
                    $i++;
                    $hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : '';
                    echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
                    if ('dashboard_browser_nag' != $box['id']) {
                        $widget_title = $box['title'];
                        if (is_array($box['args']) && isset($box['args']['__widget_basename'])) {
                            $widget_title = $box['args']['__widget_basename'];
                            // Do not pass this parameter to the user callback function.
                            unset($box['args']['__widget_basename']);
                        }
                        echo '<button type="button" class="handlediv" aria-expanded="true">';
                        echo '<span class="screen-reader-text">' . sprintf(__('Toggle panel: %s'), $widget_title) . '</span>';
                        echo '<span class="toggle-indicator" aria-hidden="true"></span>';
                        echo '</button>';
                    }
                    echo "<h2 class='hndle'><span>{$box['title']}</span></h2>\n";
                    echo '<div class="inside">' . "\n";
                    call_user_func($box['callback'], $object, $box);
                    echo "</div>\n";
                    echo "</div>\n";
                }
            }
        }
    }
    echo "</div>";
    return $i;
}

WordPress Version: 9.3

/**
 * Meta-Box template function
 *
 * @since 2.5.0
 *
 * @global array $wp_meta_boxes
 *
 * @staticvar bool $already_sorted
 *
 * @param string|WP_Screen $screen  Screen identifier. If you have used add_menu_page() or
 *                                  add_submenu_page() to create a new screen (and hence screen_id)
 *                                  make sure your menu slug conforms to the limits of sanitize_key()
 *                                  otherwise the 'screen' menu may not correctly render on your page.
 * @param string           $context box context
 * @param mixed            $object  gets passed to the box callback function as first parameter
 * @return int number of meta_boxes
 */
function do_meta_boxes($screen, $context, $object)
{
    global $wp_meta_boxes;
    static $already_sorted = false;
    if (empty($screen)) {
        $screen = get_current_screen();
    } elseif (is_string($screen)) {
        $screen = convert_to_screen($screen);
    }
    $page = $screen->id;
    $hidden = get_hidden_meta_boxes($screen);
    printf('<div id="%s-sortables" class="meta-box-sortables">', htmlspecialchars($context));
    // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
    if (!$already_sorted && $sorted = get_user_option("meta-box-order_{$page}")) {
        foreach ($sorted as $box_context => $ids) {
            foreach (explode(',', $ids) as $id) {
                if ($id && 'dashboard_browser_nag' !== $id) {
                    add_meta_box($id, null, null, $screen, $box_context, 'sorted');
                }
            }
        }
    }
    $already_sorted = true;
    $i = 0;
    if (isset($wp_meta_boxes[$page][$context])) {
        foreach (array('high', 'sorted', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ((array) $wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false == $box || !$box['title']) {
                        continue;
                    }
                    $i++;
                    $hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : '';
                    echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
                    if ('dashboard_browser_nag' != $box['id']) {
                        $widget_title = $box['title'];
                        if (is_array($box['args']) && isset($box['args']['__widget_basename'])) {
                            $widget_title = $box['args']['__widget_basename'];
                            // Do not pass this parameter to the user callback function.
                            unset($box['args']['__widget_basename']);
                        }
                        echo '<button type="button" class="handlediv" aria-expanded="true">';
                        echo '<span class="screen-reader-text">' . sprintf(__('Toggle panel: %s'), $widget_title) . '</span>';
                        echo '<span class="toggle-indicator" aria-hidden="true"></span>';
                        echo '</button>';
                    }
                    echo "<h2 class='hndle'><span>{$box['title']}</span></h2>\n";
                    echo '<div class="inside">' . "\n";
                    call_user_func($box['callback'], $object, $box);
                    echo "</div>\n";
                    echo "</div>\n";
                }
            }
        }
    }
    echo "</div>";
    return $i;
}

WordPress Version: .20

/**
 * Meta-Box template function
 *
 * @since 2.5.0
 *
 * @global array $wp_meta_boxes
 *
 * @staticvar bool $already_sorted
 *
 * @param string|WP_Screen $screen  Screen identifier. If you have used add_menu_page() or
 *                                  add_submenu_page() to create a new screen (and hence screen_id)
 *                                  make sure your menu slug conforms to the limits of sanitize_key()
 *                                  otherwise the 'screen' menu may not correctly render on your page.
 * @param string           $context box context
 * @param mixed            $object  gets passed to the box callback function as first parameter
 * @return int number of meta_boxes
 */
function do_meta_boxes($screen, $context, $object)
{
    global $wp_meta_boxes;
    static $already_sorted = false;
    if (empty($screen)) {
        $screen = get_current_screen();
    } elseif (is_string($screen)) {
        $screen = convert_to_screen($screen);
    }
    $page = $screen->id;
    $hidden = get_hidden_meta_boxes($screen);
    printf('<div id="%s-sortables" class="meta-box-sortables">', esc_attr($context));
    // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
    if (!$already_sorted && $sorted = get_user_option("meta-box-order_{$page}")) {
        foreach ($sorted as $box_context => $ids) {
            foreach (explode(',', $ids) as $id) {
                if ($id && 'dashboard_browser_nag' !== $id) {
                    add_meta_box($id, null, null, $screen, $box_context, 'sorted');
                }
            }
        }
    }
    $already_sorted = true;
    $i = 0;
    if (isset($wp_meta_boxes[$page][$context])) {
        foreach (array('high', 'sorted', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ((array) $wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false == $box || !$box['title']) {
                        continue;
                    }
                    $i++;
                    $hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : '';
                    echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
                    if ('dashboard_browser_nag' != $box['id']) {
                        $widget_title = $box['title'];
                        if (is_array($box['args']) && isset($box['args']['__widget_basename'])) {
                            $widget_title = $box['args']['__widget_basename'];
                            // Do not pass this parameter to the user callback function.
                            unset($box['args']['__widget_basename']);
                        }
                        echo '<button type="button" class="handlediv" aria-expanded="true">';
                        echo '<span class="screen-reader-text">' . sprintf(__('Toggle panel: %s'), $widget_title) . '</span>';
                        echo '<span class="toggle-indicator" aria-hidden="true"></span>';
                        echo '</button>';
                    }
                    echo "<h2 class='hndle'><span>{$box['title']}</span></h2>\n";
                    echo '<div class="inside">' . "\n";
                    call_user_func($box['callback'], $object, $box);
                    echo "</div>\n";
                    echo "</div>\n";
                }
            }
        }
    }
    echo "</div>";
    return $i;
}

WordPress Version: 9.2

/**
 * Meta-Box template function
 *
 * @since 2.5.0
 *
 * @global array $wp_meta_boxes
 *
 * @staticvar bool $already_sorted
 *
 * @param string|WP_Screen $screen  Screen identifier. If you have used add_menu_page() or
 *                                  add_submenu_page() to create a new screen (and hence screen_id)
 *                                  make sure your menu slug conforms to the limits of sanitize_key()
 *                                  otherwise the 'screen' menu may not correctly render on your page.
 * @param string           $context box context
 * @param mixed            $object  gets passed to the box callback function as first parameter
 * @return int number of meta_boxes
 */
function do_meta_boxes($screen, $context, $object)
{
    global $wp_meta_boxes;
    static $already_sorted = false;
    if (empty($screen)) {
        $screen = get_current_screen();
    } elseif (is_string($screen)) {
        $screen = convert_to_screen($screen);
    }
    $page = $screen->id;
    $hidden = get_hidden_meta_boxes($screen);
    printf('<div id="%s-sortables" class="meta-box-sortables">', htmlspecialchars($context));
    // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
    if (!$already_sorted && $sorted = get_user_option("meta-box-order_{$page}")) {
        foreach ($sorted as $box_context => $ids) {
            foreach (explode(',', $ids) as $id) {
                if ($id && 'dashboard_browser_nag' !== $id) {
                    add_meta_box($id, null, null, $screen, $box_context, 'sorted');
                }
            }
        }
    }
    $already_sorted = true;
    $i = 0;
    if (isset($wp_meta_boxes[$page][$context])) {
        foreach (array('high', 'sorted', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ((array) $wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false == $box || !$box['title']) {
                        continue;
                    }
                    $i++;
                    $hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : '';
                    echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
                    if ('dashboard_browser_nag' != $box['id']) {
                        $widget_title = $box['title'];
                        if (is_array($box['args']) && isset($box['args']['__widget_basename'])) {
                            $widget_title = $box['args']['__widget_basename'];
                            // Do not pass this parameter to the user callback function.
                            unset($box['args']['__widget_basename']);
                        }
                        echo '<button type="button" class="handlediv" aria-expanded="true">';
                        echo '<span class="screen-reader-text">' . sprintf(__('Toggle panel: %s'), $widget_title) . '</span>';
                        echo '<span class="toggle-indicator" aria-hidden="true"></span>';
                        echo '</button>';
                    }
                    echo "<h2 class='hndle'><span>{$box['title']}</span></h2>\n";
                    echo '<div class="inside">' . "\n";
                    call_user_func($box['callback'], $object, $box);
                    echo "</div>\n";
                    echo "</div>\n";
                }
            }
        }
    }
    echo "</div>";
    return $i;
}

WordPress Version: .10

/**
 * Meta-Box template function
 *
 * @since 2.5.0
 *
 * @global array $wp_meta_boxes
 *
 * @staticvar bool $already_sorted
 *
 * @param string|WP_Screen $screen  Screen identifier. If you have used add_menu_page() or
 *                                  add_submenu_page() to create a new screen (and hence screen_id)
 *                                  make sure your menu slug conforms to the limits of sanitize_key()
 *                                  otherwise the 'screen' menu may not correctly render on your page.
 * @param string           $context box context
 * @param mixed            $object  gets passed to the box callback function as first parameter
 * @return int number of meta_boxes
 */
function do_meta_boxes($screen, $context, $object)
{
    global $wp_meta_boxes;
    static $already_sorted = false;
    if (empty($screen)) {
        $screen = get_current_screen();
    } elseif (is_string($screen)) {
        $screen = convert_to_screen($screen);
    }
    $page = $screen->id;
    $hidden = get_hidden_meta_boxes($screen);
    printf('<div id="%s-sortables" class="meta-box-sortables">', esc_attr($context));
    // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
    if (!$already_sorted && $sorted = get_user_option("meta-box-order_{$page}")) {
        foreach ($sorted as $box_context => $ids) {
            foreach (explode(',', $ids) as $id) {
                if ($id && 'dashboard_browser_nag' !== $id) {
                    add_meta_box($id, null, null, $screen, $box_context, 'sorted');
                }
            }
        }
    }
    $already_sorted = true;
    $i = 0;
    if (isset($wp_meta_boxes[$page][$context])) {
        foreach (array('high', 'sorted', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ((array) $wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false == $box || !$box['title']) {
                        continue;
                    }
                    $i++;
                    $hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : '';
                    echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
                    if ('dashboard_browser_nag' != $box['id']) {
                        $widget_title = $box['title'];
                        if (is_array($box['args']) && isset($box['args']['__widget_basename'])) {
                            $widget_title = $box['args']['__widget_basename'];
                            // Do not pass this parameter to the user callback function.
                            unset($box['args']['__widget_basename']);
                        }
                        echo '<button type="button" class="handlediv" aria-expanded="true">';
                        echo '<span class="screen-reader-text">' . sprintf(__('Toggle panel: %s'), $widget_title) . '</span>';
                        echo '<span class="toggle-indicator" aria-hidden="true"></span>';
                        echo '</button>';
                    }
                    echo "<h2 class='hndle'><span>{$box['title']}</span></h2>\n";
                    echo '<div class="inside">' . "\n";
                    call_user_func($box['callback'], $object, $box);
                    echo "</div>\n";
                    echo "</div>\n";
                }
            }
        }
    }
    echo "</div>";
    return $i;
}

WordPress Version: 4.9

/**
 * Meta-Box template function
 *
 * @since 2.5.0
 *
 * @global array $wp_meta_boxes
 *
 * @staticvar bool $already_sorted
 *
 * @param string|WP_Screen $screen  Screen identifier. If you have used add_menu_page() or
 *                                  add_submenu_page() to create a new screen (and hence screen_id)
 *                                  make sure your menu slug conforms to the limits of sanitize_key()
 *                                  otherwise the 'screen' menu may not correctly render on your page.
 * @param string           $context box context
 * @param mixed            $object  gets passed to the box callback function as first parameter
 * @return int number of meta_boxes
 */
function do_meta_boxes($screen, $context, $object)
{
    global $wp_meta_boxes;
    static $already_sorted = false;
    if (empty($screen)) {
        $screen = get_current_screen();
    } elseif (is_string($screen)) {
        $screen = convert_to_screen($screen);
    }
    $page = $screen->id;
    $hidden = get_hidden_meta_boxes($screen);
    printf('<div id="%s-sortables" class="meta-box-sortables">', htmlspecialchars($context));
    // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
    if (!$already_sorted && $sorted = get_user_option("meta-box-order_{$page}")) {
        foreach ($sorted as $box_context => $ids) {
            foreach (explode(',', $ids) as $id) {
                if ($id && 'dashboard_browser_nag' !== $id) {
                    add_meta_box($id, null, null, $screen, $box_context, 'sorted');
                }
            }
        }
    }
    $already_sorted = true;
    $i = 0;
    if (isset($wp_meta_boxes[$page][$context])) {
        foreach (array('high', 'sorted', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ((array) $wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false == $box || !$box['title']) {
                        continue;
                    }
                    $i++;
                    $hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : '';
                    echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
                    if ('dashboard_browser_nag' != $box['id']) {
                        $widget_title = $box['title'];
                        if (is_array($box['args']) && isset($box['args']['__widget_basename'])) {
                            $widget_title = $box['args']['__widget_basename'];
                            // Do not pass this parameter to the user callback function.
                            unset($box['args']['__widget_basename']);
                        }
                        echo '<button type="button" class="handlediv" aria-expanded="true">';
                        echo '<span class="screen-reader-text">' . sprintf(__('Toggle panel: %s'), $widget_title) . '</span>';
                        echo '<span class="toggle-indicator" aria-hidden="true"></span>';
                        echo '</button>';
                    }
                    echo "<h2 class='hndle'><span>{$box['title']}</span></h2>\n";
                    echo '<div class="inside">' . "\n";
                    call_user_func($box['callback'], $object, $box);
                    echo "</div>\n";
                    echo "</div>\n";
                }
            }
        }
    }
    echo "</div>";
    return $i;
}

WordPress Version: 4.8

/**
 * Meta-Box template function
 *
 * @since 2.5.0
 *
 * @global array $wp_meta_boxes
 *
 * @staticvar bool $already_sorted
 * @param string|WP_Screen $screen  Screen identifier
 * @param string           $context box context
 * @param mixed            $object  gets passed to the box callback function as first parameter
 * @return int number of meta_boxes
 */
function do_meta_boxes($screen, $context, $object)
{
    global $wp_meta_boxes;
    static $already_sorted = false;
    if (empty($screen)) {
        $screen = get_current_screen();
    } elseif (is_string($screen)) {
        $screen = convert_to_screen($screen);
    }
    $page = $screen->id;
    $hidden = get_hidden_meta_boxes($screen);
    printf('<div id="%s-sortables" class="meta-box-sortables">', htmlspecialchars($context));
    // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
    if (!$already_sorted && $sorted = get_user_option("meta-box-order_{$page}")) {
        foreach ($sorted as $box_context => $ids) {
            foreach (explode(',', $ids) as $id) {
                if ($id && 'dashboard_browser_nag' !== $id) {
                    add_meta_box($id, null, null, $screen, $box_context, 'sorted');
                }
            }
        }
    }
    $already_sorted = true;
    $i = 0;
    if (isset($wp_meta_boxes[$page][$context])) {
        foreach (array('high', 'sorted', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ((array) $wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false == $box || !$box['title']) {
                        continue;
                    }
                    $i++;
                    $hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : '';
                    echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
                    if ('dashboard_browser_nag' != $box['id']) {
                        $widget_title = $box['title'];
                        if (is_array($box['args']) && isset($box['args']['__widget_basename'])) {
                            $widget_title = $box['args']['__widget_basename'];
                            // Do not pass this parameter to the user callback function.
                            unset($box['args']['__widget_basename']);
                        }
                        echo '<button type="button" class="handlediv" aria-expanded="true">';
                        echo '<span class="screen-reader-text">' . sprintf(__('Toggle panel: %s'), $widget_title) . '</span>';
                        echo '<span class="toggle-indicator" aria-hidden="true"></span>';
                        echo '</button>';
                    }
                    echo "<h2 class='hndle'><span>{$box['title']}</span></h2>\n";
                    echo '<div class="inside">' . "\n";
                    call_user_func($box['callback'], $object, $box);
                    echo "</div>\n";
                    echo "</div>\n";
                }
            }
        }
    }
    echo "</div>";
    return $i;
}

WordPress Version: 4.6

/**
 * Meta-Box template function
 *
 * @since 2.5.0
 *
 * @global array $wp_meta_boxes
 *
 * @staticvar bool $already_sorted
 * @param string|WP_Screen $screen  Screen identifier
 * @param string           $context box context
 * @param mixed            $object  gets passed to the box callback function as first parameter
 * @return int number of meta_boxes
 */
function do_meta_boxes($screen, $context, $object)
{
    global $wp_meta_boxes;
    static $already_sorted = false;
    if (empty($screen)) {
        $screen = get_current_screen();
    } elseif (is_string($screen)) {
        $screen = convert_to_screen($screen);
    }
    $page = $screen->id;
    $hidden = get_hidden_meta_boxes($screen);
    printf('<div id="%s-sortables" class="meta-box-sortables">', htmlspecialchars($context));
    // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
    if (!$already_sorted && $sorted = get_user_option("meta-box-order_{$page}")) {
        foreach ($sorted as $box_context => $ids) {
            foreach (explode(',', $ids) as $id) {
                if ($id && 'dashboard_browser_nag' !== $id) {
                    add_meta_box($id, null, null, $screen, $box_context, 'sorted');
                }
            }
        }
    }
    $already_sorted = true;
    $i = 0;
    if (isset($wp_meta_boxes[$page][$context])) {
        foreach (array('high', 'sorted', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ((array) $wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false == $box || !$box['title']) {
                        continue;
                    }
                    $i++;
                    $hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : '';
                    echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
                    if ('dashboard_browser_nag' != $box['id']) {
                        $widget_title = $box['title'];
                        if (is_array($box['args']) && isset($box['args']['__widget_basename'])) {
                            $widget_title = $box['args']['__widget_basename'];
                            // Do not pass this parameter to the user callback function.
                            unset($box['args']['__widget_basename']);
                        }
                        echo '<button type="button" class="handlediv button-link" aria-expanded="true">';
                        echo '<span class="screen-reader-text">' . sprintf(__('Toggle panel: %s'), $widget_title) . '</span>';
                        echo '<span class="toggle-indicator" aria-hidden="true"></span>';
                        echo '</button>';
                    }
                    echo "<h2 class='hndle'><span>{$box['title']}</span></h2>\n";
                    echo '<div class="inside">' . "\n";
                    call_user_func($box['callback'], $object, $box);
                    echo "</div>\n";
                    echo "</div>\n";
                }
            }
        }
    }
    echo "</div>";
    return $i;
}

WordPress Version: 4.4

/**
 * Meta-Box template function
 *
 * @since 2.5.0
 *
 * @global array $wp_meta_boxes
 *
 * @staticvar bool $already_sorted
 * @param string|WP_Screen $screen  Screen identifier
 * @param string           $context box context
 * @param mixed            $object  gets passed to the box callback function as first parameter
 * @return int number of meta_boxes
 */
function do_meta_boxes($screen, $context, $object)
{
    global $wp_meta_boxes;
    static $already_sorted = false;
    if (empty($screen)) {
        $screen = get_current_screen();
    } elseif (is_string($screen)) {
        $screen = convert_to_screen($screen);
    }
    $page = $screen->id;
    $hidden = get_hidden_meta_boxes($screen);
    printf('<div id="%s-sortables" class="meta-box-sortables">', htmlspecialchars($context));
    // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
    if (!$already_sorted && $sorted = get_user_option("meta-box-order_{$page}")) {
        foreach ($sorted as $box_context => $ids) {
            foreach (explode(',', $ids) as $id) {
                if ($id && 'dashboard_browser_nag' !== $id) {
                    add_meta_box($id, null, null, $screen, $box_context, 'sorted');
                }
            }
        }
    }
    $already_sorted = true;
    $i = 0;
    if (isset($wp_meta_boxes[$page][$context])) {
        foreach (array('high', 'sorted', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ((array) $wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false == $box || !$box['title']) {
                        continue;
                    }
                    $i++;
                    $hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : '';
                    echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
                    if ('dashboard_browser_nag' != $box['id']) {
                        echo '<button type="button" class="handlediv button-link" aria-expanded="true">';
                        echo '<span class="screen-reader-text">' . sprintf(__('Toggle panel: %s'), $box['title']) . '</span>';
                        echo '<span class="toggle-indicator" aria-hidden="true"></span>';
                        echo '</button>';
                    }
                    echo "<h2 class='hndle'><span>{$box['title']}</span></h2>\n";
                    echo '<div class="inside">' . "\n";
                    call_user_func($box['callback'], $object, $box);
                    echo "</div>\n";
                    echo "</div>\n";
                }
            }
        }
    }
    echo "</div>";
    return $i;
}

WordPress Version: 4.3

/**
 * Meta-Box template function
 *
 * @since 2.5.0
 *
 * @global array $wp_meta_boxes
 *
 * @staticvar bool $already_sorted
 * @param string|WP_Screen $screen  Screen identifier
 * @param string           $context box context
 * @param mixed            $object  gets passed to the box callback function as first parameter
 * @return int number of meta_boxes
 */
function do_meta_boxes($screen, $context, $object)
{
    global $wp_meta_boxes;
    static $already_sorted = false;
    if (empty($screen)) {
        $screen = get_current_screen();
    } elseif (is_string($screen)) {
        $screen = convert_to_screen($screen);
    }
    $page = $screen->id;
    $hidden = get_hidden_meta_boxes($screen);
    printf('<div id="%s-sortables" class="meta-box-sortables">', htmlspecialchars($context));
    // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
    if (!$already_sorted && $sorted = get_user_option("meta-box-order_{$page}")) {
        foreach ($sorted as $box_context => $ids) {
            foreach (explode(',', $ids) as $id) {
                if ($id && 'dashboard_browser_nag' !== $id) {
                    add_meta_box($id, null, null, $screen, $box_context, 'sorted');
                }
            }
        }
    }
    $already_sorted = true;
    $i = 0;
    if (isset($wp_meta_boxes[$page][$context])) {
        foreach (array('high', 'sorted', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ((array) $wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false == $box || !$box['title']) {
                        continue;
                    }
                    $i++;
                    $hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : '';
                    echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
                    if ('dashboard_browser_nag' != $box['id']) {
                        echo '<div class="handlediv" title="' . esc_attr__('Click to toggle') . '"><br /></div>';
                    }
                    echo "<h3 class='hndle'><span>{$box['title']}</span></h3>\n";
                    echo '<div class="inside">' . "\n";
                    call_user_func($box['callback'], $object, $box);
                    echo "</div>\n";
                    echo "</div>\n";
                }
            }
        }
    }
    echo "</div>";
    return $i;
}

WordPress Version: 4.1

/**
 * Meta-Box template function
 *
 * @since 2.5.0
 *
 * @staticvar bool $already_sorted
 * @param string|WP_Screen $screen Screen identifier
 * @param string $context box context
 * @param mixed $object gets passed to the box callback function as first parameter
 * @return int number of meta_boxes
 */
function do_meta_boxes($screen, $context, $object)
{
    global $wp_meta_boxes;
    static $already_sorted = false;
    if (empty($screen)) {
        $screen = get_current_screen();
    } elseif (is_string($screen)) {
        $screen = convert_to_screen($screen);
    }
    $page = $screen->id;
    $hidden = get_hidden_meta_boxes($screen);
    printf('<div id="%s-sortables" class="meta-box-sortables">', htmlspecialchars($context));
    // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
    if (!$already_sorted && $sorted = get_user_option("meta-box-order_{$page}")) {
        foreach ($sorted as $box_context => $ids) {
            foreach (explode(',', $ids) as $id) {
                if ($id && 'dashboard_browser_nag' !== $id) {
                    add_meta_box($id, null, null, $screen, $box_context, 'sorted');
                }
            }
        }
    }
    $already_sorted = true;
    $i = 0;
    if (isset($wp_meta_boxes[$page][$context])) {
        foreach (array('high', 'sorted', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ((array) $wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false == $box || !$box['title']) {
                        continue;
                    }
                    $i++;
                    $hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : '';
                    echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
                    if ('dashboard_browser_nag' != $box['id']) {
                        echo '<div class="handlediv" title="' . esc_attr__('Click to toggle') . '"><br /></div>';
                    }
                    echo "<h3 class='hndle'><span>{$box['title']}</span></h3>\n";
                    echo '<div class="inside">' . "\n";
                    call_user_func($box['callback'], $object, $box);
                    echo "</div>\n";
                    echo "</div>\n";
                }
            }
        }
    }
    echo "</div>";
    return $i;
}

WordPress Version: 3.7

/**
 * Meta-Box template function
 *
 * @since 2.5.0
 *
 * @param string|object $screen Screen identifier
 * @param string $context box context
 * @param mixed $object gets passed to the box callback function as first parameter
 * @return int number of meta_boxes
 */
function do_meta_boxes($screen, $context, $object)
{
    global $wp_meta_boxes;
    static $already_sorted = false;
    if (empty($screen)) {
        $screen = get_current_screen();
    } elseif (is_string($screen)) {
        $screen = convert_to_screen($screen);
    }
    $page = $screen->id;
    $hidden = get_hidden_meta_boxes($screen);
    printf('<div id="%s-sortables" class="meta-box-sortables">', htmlspecialchars($context));
    $i = 0;
    do {
        // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
        if (!$already_sorted && $sorted = get_user_option("meta-box-order_{$page}")) {
            foreach ($sorted as $box_context => $ids) {
                foreach (explode(',', $ids) as $id) {
                    if ($id && 'dashboard_browser_nag' !== $id) {
                        add_meta_box($id, null, null, $screen, $box_context, 'sorted');
                    }
                }
            }
        }
        $already_sorted = true;
        if (!isset($wp_meta_boxes) || !isset($wp_meta_boxes[$page]) || !isset($wp_meta_boxes[$page][$context])) {
            break;
        }
        foreach (array('high', 'sorted', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ((array) $wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false == $box || !$box['title']) {
                        continue;
                    }
                    $i++;
                    $hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : '';
                    echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
                    if ('dashboard_browser_nag' != $box['id']) {
                        echo '<div class="handlediv" title="' . esc_attr__('Click to toggle') . '"><br /></div>';
                    }
                    echo "<h3 class='hndle'><span>{$box['title']}</span></h3>\n";
                    echo '<div class="inside">' . "\n";
                    call_user_func($box['callback'], $object, $box);
                    echo "</div>\n";
                    echo "</div>\n";
                }
            }
        }
    } while (0);
    echo "</div>";
    return $i;
}