wp_admin_bar_customize_menu

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

WordPress Version: 6.5

/**
 * Adds the "Customize" link to the Toolbar.
 *
 * @since 4.3.0
 *
 * @global WP_Customize_Manager $wp_customize
 *
 * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
 */
function wp_admin_bar_customize_menu($wp_admin_bar)
{
    global $wp_customize;
    // Don't show if a block theme is activated and no plugins use the customizer.
    if (wp_is_block_theme() && !has_action('customize_register')) {
        return;
    }
    // Don't show for users who can't access the customizer or when in the admin.
    if (!current_user_can('customize') || is_admin()) {
        return;
    }
    // Don't show if the user cannot edit a given customize_changeset post currently being previewed.
    if (is_customize_preview() && $wp_customize->changeset_post_id() && !current_user_can(get_post_type_object('customize_changeset')->cap->edit_post, $wp_customize->changeset_post_id())) {
        return;
    }
    $current_url = (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    if (is_customize_preview() && $wp_customize->changeset_uuid()) {
        $current_url = remove_query_arg('customize_changeset_uuid', $current_url);
    }
    $customize_url = add_query_arg('url', urlencode($current_url), wp_customize_url());
    if (is_customize_preview()) {
        $customize_url = add_query_arg(array('changeset_uuid' => $wp_customize->changeset_uuid()), $customize_url);
    }
    $wp_admin_bar->add_node(array('id' => 'customize', 'title' => __('Customize'), 'href' => $customize_url, 'meta' => array('class' => 'hide-if-no-customize')));
    add_action('wp_before_admin_bar_render', 'wp_customize_support_script');
}

WordPress Version: 5.9

/**
 * Adds the "Customize" link to the Toolbar.
 *
 * @since 4.3.0
 *
 * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
 * @global WP_Customize_Manager $wp_customize
 */
function wp_admin_bar_customize_menu($wp_admin_bar)
{
    global $wp_customize;
    // Don't show if a block theme is activated and no plugins use the customizer.
    if (wp_is_block_theme() && !has_action('customize_register')) {
        return;
    }
    // Don't show for users who can't access the customizer or when in the admin.
    if (!current_user_can('customize') || is_admin()) {
        return;
    }
    // Don't show if the user cannot edit a given customize_changeset post currently being previewed.
    if (is_customize_preview() && $wp_customize->changeset_post_id() && !current_user_can(get_post_type_object('customize_changeset')->cap->edit_post, $wp_customize->changeset_post_id())) {
        return;
    }
    $current_url = (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    if (is_customize_preview() && $wp_customize->changeset_uuid()) {
        $current_url = remove_query_arg('customize_changeset_uuid', $current_url);
    }
    $customize_url = add_query_arg('url', urlencode($current_url), wp_customize_url());
    if (is_customize_preview()) {
        $customize_url = add_query_arg(array('changeset_uuid' => $wp_customize->changeset_uuid()), $customize_url);
    }
    $wp_admin_bar->add_node(array('id' => 'customize', 'title' => __('Customize'), 'href' => $customize_url, 'meta' => array('class' => 'hide-if-no-customize')));
    add_action('wp_before_admin_bar_render', 'wp_customize_support_script');
}

WordPress Version: 5.4

/**
 * Adds the "Customize" link to the Toolbar.
 *
 * @since 4.3.0
 *
 * @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance.
 * @global WP_Customize_Manager $wp_customize
 */
function wp_admin_bar_customize_menu($wp_admin_bar)
{
    global $wp_customize;
    // Don't show for users who can't access the customizer or when in the admin.
    if (!current_user_can('customize') || is_admin()) {
        return;
    }
    // Don't show if the user cannot edit a given customize_changeset post currently being previewed.
    if (is_customize_preview() && $wp_customize->changeset_post_id() && !current_user_can(get_post_type_object('customize_changeset')->cap->edit_post, $wp_customize->changeset_post_id())) {
        return;
    }
    $current_url = (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    if (is_customize_preview() && $wp_customize->changeset_uuid()) {
        $current_url = remove_query_arg('customize_changeset_uuid', $current_url);
    }
    $customize_url = add_query_arg('url', urlencode($current_url), wp_customize_url());
    if (is_customize_preview()) {
        $customize_url = add_query_arg(array('changeset_uuid' => $wp_customize->changeset_uuid()), $customize_url);
    }
    $wp_admin_bar->add_node(array('id' => 'customize', 'title' => __('Customize'), 'href' => $customize_url, 'meta' => array('class' => 'hide-if-no-customize')));
    add_action('wp_before_admin_bar_render', 'wp_customize_support_script');
}

WordPress Version: 4.7

/**
 * Adds the "Customize" link to the Toolbar.
 *
 * @since 4.3.0
 *
 * @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance.
 * @global WP_Customize_Manager $wp_customize
 */
function wp_admin_bar_customize_menu($wp_admin_bar)
{
    global $wp_customize;
    // Don't show for users who can't access the customizer or when in the admin.
    if (!current_user_can('customize') || is_admin()) {
        return;
    }
    // Don't show if the user cannot edit a given customize_changeset post currently being previewed.
    if (is_customize_preview() && $wp_customize->changeset_post_id() && !current_user_can(get_post_type_object('customize_changeset')->cap->edit_post, $wp_customize->changeset_post_id())) {
        return;
    }
    $current_url = (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    if (is_customize_preview() && $wp_customize->changeset_uuid()) {
        $current_url = remove_query_arg('customize_changeset_uuid', $current_url);
    }
    $customize_url = add_query_arg('url', urlencode($current_url), wp_customize_url());
    if (is_customize_preview()) {
        $customize_url = add_query_arg(array('changeset_uuid' => $wp_customize->changeset_uuid()), $customize_url);
    }
    $wp_admin_bar->add_menu(array('id' => 'customize', 'title' => __('Customize'), 'href' => $customize_url, 'meta' => array('class' => 'hide-if-no-customize')));
    add_action('wp_before_admin_bar_render', 'wp_customize_support_script');
}

WordPress Version: 4.3

/**
 * Adds the "Customize" link to the Toolbar.
 *
 * @since 4.3.0
 *
 * @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance.
 */
function wp_admin_bar_customize_menu($wp_admin_bar)
{
    // Don't show for users who can't access the customizer or when in the admin.
    if (!current_user_can('customize') || is_admin()) {
        return;
    }
    $current_url = (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    $customize_url = add_query_arg('url', urlencode($current_url), wp_customize_url());
    $wp_admin_bar->add_menu(array('id' => 'customize', 'title' => __('Customize'), 'href' => $customize_url, 'meta' => array('class' => 'hide-if-no-customize')));
    add_action('wp_before_admin_bar_render', 'wp_customize_support_script');
}