wp_admin_bar_render

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

WordPress Version: 5.9

/**
 * Renders the admin bar to the page based on the $wp_admin_bar->menu member var.
 *
 * This is called very early on the {@see 'wp_body_open'} action so that it will render
 * before anything else being added to the page body.
 *
 * For backward compatibility with themes not using the 'wp_body_open' action,
 * the function is also called late on {@see 'wp_footer'}.
 *
 * It includes the {@see 'admin_bar_menu'} action which should be used to hook in and
 * add new menus to the admin bar. That way you can be sure that you are adding at most
 * optimal point, right before the admin bar is rendered. This also gives you access to
 * the `$post` global, among others.
 *
 * @since 3.1.0
 * @since 5.4.0 Called on 'wp_body_open' action first, with 'wp_footer' as a fallback.
 *
 * @global WP_Admin_Bar $wp_admin_bar
 */
function wp_admin_bar_render()
{
    global $wp_admin_bar;
    static $rendered = false;
    if ($rendered) {
        return;
    }
    if (!is_admin_bar_showing() || !is_object($wp_admin_bar)) {
        return;
    }
    /**
     * Loads all necessary admin bar items.
     *
     * This is the hook used to add, remove, or manipulate admin bar items.
     *
     * @since 3.1.0
     *
     * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance, passed by reference.
     */
    do_action_ref_array('admin_bar_menu', array(&$wp_admin_bar));
    /**
     * Fires before the admin bar is rendered.
     *
     * @since 3.1.0
     */
    do_action('wp_before_admin_bar_render');
    $wp_admin_bar->render();
    /**
     * Fires after the admin bar is rendered.
     *
     * @since 3.1.0
     */
    do_action('wp_after_admin_bar_render');
    $rendered = true;
}

WordPress Version: 5.5

/**
 * Renders the admin bar to the page based on the $wp_admin_bar->menu member var.
 *
 * This is called very early on the {@see 'wp_body_open'} action so that it will render
 * before anything else being added to the page body.
 *
 * For backward compatibility with themes not using the 'wp_body_open' action,
 * the function is also called late on {@see 'wp_footer'}.
 *
 * It includes the {@see 'admin_bar_menu'} action which should be used to hook in and
 * add new menus to the admin bar. That way you can be sure that you are adding at most
 * optimal point, right before the admin bar is rendered. This also gives you access to
 * the `$post` global, among others.
 *
 * @since 3.1.0
 * @since 5.4.0 Called on 'wp_body_open' action first, with 'wp_footer' as a fallback.
 *
 * @global WP_Admin_Bar $wp_admin_bar
 */
function wp_admin_bar_render()
{
    global $wp_admin_bar;
    static $rendered = false;
    if ($rendered) {
        return;
    }
    if (!is_admin_bar_showing() || !is_object($wp_admin_bar)) {
        return;
    }
    /**
     * Load all necessary admin bar items.
     *
     * This is the hook used to add, remove, or manipulate admin bar items.
     *
     * @since 3.1.0
     *
     * @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance, passed by reference
     */
    do_action_ref_array('admin_bar_menu', array(&$wp_admin_bar));
    /**
     * Fires before the admin bar is rendered.
     *
     * @since 3.1.0
     */
    do_action('wp_before_admin_bar_render');
    $wp_admin_bar->render();
    /**
     * Fires after the admin bar is rendered.
     *
     * @since 3.1.0
     */
    do_action('wp_after_admin_bar_render');
    $rendered = true;
}

WordPress Version: 5.4

/**
 * Renders the admin bar to the page based on the $wp_admin_bar->menu member var.
 *
 * This is called very early on the {@see 'wp_body_open'} action so that it will render
 * before anything else being added to the page body.
 *
 * For backward compatibility with themes not using the 'wp_body_open' action,
 * the function is also called late on {@see 'wp_footer'}.
 *
 * It includes the {@see 'admin_bar_menu'} action which should be used to hook in and
 * add new menus to the admin bar. That way you can be sure that you are adding at most
 * optimal point, right before the admin bar is rendered. This also gives you access to
 * the `$post` global, among others.
 *
 * @since 3.1.0
 * @since 5.4.0 Called on 'wp_body_open' action first, with 'wp_footer' as a fallback.
 *
 * @global WP_Admin_Bar $wp_admin_bar
 *
 * @staticvar bool $rendered
 */
function wp_admin_bar_render()
{
    global $wp_admin_bar;
    static $rendered = false;
    if ($rendered) {
        return;
    }
    if (!is_admin_bar_showing() || !is_object($wp_admin_bar)) {
        return;
    }
    /**
     * Load all necessary admin bar items.
     *
     * This is the hook used to add, remove, or manipulate admin bar items.
     *
     * @since 3.1.0
     *
     * @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance, passed by reference
     */
    do_action_ref_array('admin_bar_menu', array(&$wp_admin_bar));
    /**
     * Fires before the admin bar is rendered.
     *
     * @since 3.1.0
     */
    do_action('wp_before_admin_bar_render');
    $wp_admin_bar->render();
    /**
     * Fires after the admin bar is rendered.
     *
     * @since 3.1.0
     */
    do_action('wp_after_admin_bar_render');
    $rendered = true;
}

WordPress Version: 4.6

/**
 * Renders the admin bar to the page based on the $wp_admin_bar->menu member var.
 *
 * This is called very late on the footer actions so that it will render after
 * anything else being added to the footer.
 *
 * It includes the {@see 'admin_bar_menu'} action which should be used to hook in and
 * add new menus to the admin bar. That way you can be sure that you are adding at most
 * optimal point, right before the admin bar is rendered. This also gives you access to
 * the `$post` global, among others.
 *
 * @since 3.1.0
 *
 * @global WP_Admin_Bar $wp_admin_bar
 */
function wp_admin_bar_render()
{
    global $wp_admin_bar;
    if (!is_admin_bar_showing() || !is_object($wp_admin_bar)) {
        return;
    }
    /**
     * Load all necessary admin bar items.
     *
     * This is the hook used to add, remove, or manipulate admin bar items.
     *
     * @since 3.1.0
     *
     * @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance, passed by reference
     */
    do_action_ref_array('admin_bar_menu', array(&$wp_admin_bar));
    /**
     * Fires before the admin bar is rendered.
     *
     * @since 3.1.0
     */
    do_action('wp_before_admin_bar_render');
    $wp_admin_bar->render();
    /**
     * Fires after the admin bar is rendered.
     *
     * @since 3.1.0
     */
    do_action('wp_after_admin_bar_render');
}

WordPress Version: 4.3

/**
 * Render the admin bar to the page based on the $wp_admin_bar->menu member var.
 * This is called very late on the footer actions so that it will render after anything else being
 * added to the footer.
 *
 * It includes the action "admin_bar_menu" which should be used to hook in and
 * add new menus to the admin bar. That way you can be sure that you are adding at most optimal point,
 * right before the admin bar is rendered. This also gives you access to the $post global, among others.
 *
 * @since 3.1.0
 *
 * @global WP_Admin_Bar $wp_admin_bar
 */
function wp_admin_bar_render()
{
    global $wp_admin_bar;
    if (!is_admin_bar_showing() || !is_object($wp_admin_bar)) {
        return;
    }
    /**
     * Load all necessary admin bar items.
     *
     * This is the hook used to add, remove, or manipulate admin bar items.
     *
     * @since 3.1.0
     *
     * @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance, passed by reference
     */
    do_action_ref_array('admin_bar_menu', array(&$wp_admin_bar));
    /**
     * Fires before the admin bar is rendered.
     *
     * @since 3.1.0
     */
    do_action('wp_before_admin_bar_render');
    $wp_admin_bar->render();
    /**
     * Fires after the admin bar is rendered.
     *
     * @since 3.1.0
     */
    do_action('wp_after_admin_bar_render');
}

WordPress Version: 3.8

/**
 * Render the admin bar to the page based on the $wp_admin_bar->menu member var.
 * This is called very late on the footer actions so that it will render after anything else being
 * added to the footer.
 *
 * It includes the action "admin_bar_menu" which should be used to hook in and
 * add new menus to the admin bar. That way you can be sure that you are adding at most optimal point,
 * right before the admin bar is rendered. This also gives you access to the $post global, among others.
 *
 * @since 3.1.0
 */
function wp_admin_bar_render()
{
    global $wp_admin_bar;
    if (!is_admin_bar_showing() || !is_object($wp_admin_bar)) {
        return false;
    }
    /**
     * Load all necessary admin bar items.
     *
     * This is the hook used to add, remove, or manipulate admin bar items.
     *
     * @since 3.1.0
     *
     * @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance, passed by reference
     */
    do_action_ref_array('admin_bar_menu', array(&$wp_admin_bar));
    /**
     * Fires before the admin bar is rendered.
     *
     * @since 3.1.0
     */
    do_action('wp_before_admin_bar_render');
    $wp_admin_bar->render();
    /**
     * Fires after the admin bar is rendered.
     *
     * @since 3.1.0
     */
    do_action('wp_after_admin_bar_render');
}

WordPress Version: 3.7

/**
 * Render the admin bar to the page based on the $wp_admin_bar->menu member var.
 * This is called very late on the footer actions so that it will render after anything else being
 * added to the footer.
 *
 * It includes the action "admin_bar_menu" which should be used to hook in and
 * add new menus to the admin bar. That way you can be sure that you are adding at most optimal point,
 * right before the admin bar is rendered. This also gives you access to the $post global, among others.
 *
 * @since 3.1.0
 */
function wp_admin_bar_render()
{
    global $wp_admin_bar;
    if (!is_admin_bar_showing() || !is_object($wp_admin_bar)) {
        return false;
    }
    do_action_ref_array('admin_bar_menu', array(&$wp_admin_bar));
    do_action('wp_before_admin_bar_render');
    $wp_admin_bar->render();
    do_action('wp_after_admin_bar_render');
}