wp_admin_bar_customize_menu( WP_Admin_Bar $wp_admin_bar )
- Since
- 4.3.0
- Source
wp-includes/admin-bar.php:520
Compatibility
- WordPress
- since 4.3.0
- PHP
- 7.4–8.6-dev
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.
Parameters
$wp_admin_barWP_Admin_Bar- The WP_Admin_Bar instance.
Performance profile
How much work a call to wp_admin_bar_customize_menu() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Trivial
- Scaling
- Constant
- Instructions
- 10–94
- Plugin surface
- None
- Called by
- 0
Touches nothing outside its own arguments.
No loop in the body: the same number of instructions runs whatever you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 98.
Nothing here hands control to plugin code.
Nothing in core calls this; the cost is only what you spend yourself.
What one call costs · 43 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost wp_admin_bar_customize_menu() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
!wp_is_block_theme() && !current_user_can() | 10 | wp_is_block_theme(), current_user_can() |
wp_is_block_theme() && !has_action() | 10 | wp_is_block_theme(), has_action() |
!wp_is_block_theme() && current_user_can() && is_admin() | 13 | wp_is_block_theme(), current_user_can(), is_admin() |
wp_is_block_theme() && has_action() && !current_user_can() | 14 | wp_is_block_theme(), has_action(), current_user_can() |
wp_is_block_theme() && has_action() && current_user_can() && is_admin() | 17 | wp_is_block_theme(), has_action(), current_user_can(), is_admin() |
!wp_is_block_theme() && !is_admin() && is_customize_preview() && ->changeset_post_id() | 32 | wp_is_block_theme(), current_user_can(), is_admin(), is_customize_preview(), ->changeset_post_id(), get_post_type_object(), ->changeset_post_id(), current_user_can() |
wp_is_block_theme() && has_action() && !is_admin() && is_customize_preview() && ->changeset_post_id() | 36 | wp_is_block_theme(), has_action(), current_user_can(), is_admin(), is_customize_preview(), ->changeset_post_id(), get_post_type_object(), ->changeset_post_id(), current_user_can() |
!wp_is_block_theme() && current_user_can() && !is_admin() && !is_customize_preview() | 57–58 | wp_is_block_theme(), current_user_can(), is_admin(), is_customize_preview(), is_ssl(), is_customize_preview(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), __(), customize(), add_action() |
!wp_is_block_theme() && current_user_can() && !is_admin() && !->changeset_uuid() | 60–61 | wp_is_block_theme(), current_user_can(), is_admin(), is_customize_preview(), is_ssl(), is_customize_preview(), ->changeset_uuid(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), __(), customize(), add_action() |
!wp_is_block_theme() && current_user_can() && !is_admin() && !->changeset_post_id() | 60–61 | wp_is_block_theme(), current_user_can(), is_admin(), is_customize_preview(), ->changeset_post_id(), is_ssl(), is_customize_preview(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), __(), customize(), add_action() |
wp_is_block_theme() && has_action() && current_user_can() && !is_admin() && !is_customize_preview() | 61–62 | wp_is_block_theme(), has_action(), current_user_can(), is_admin(), is_customize_preview(), is_ssl(), is_customize_preview(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), __(), customize(), add_action() |
!wp_is_block_theme() && current_user_can() && !is_admin() && !->changeset_post_id() && !->changeset_uuid() | 63–64 | wp_is_block_theme(), current_user_can(), is_admin(), is_customize_preview(), ->changeset_post_id(), is_ssl(), is_customize_preview(), ->changeset_uuid(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), __(), customize(), add_action() |
31 further outcomes, up to 94 instructions
wp_is_block_theme() && has_action() && current_user_can() && !is_admin() && !->changeset_uuid() | 64–65 | wp_is_block_theme(), has_action(), current_user_can(), is_admin(), is_customize_preview(), is_ssl(), is_customize_preview(), ->changeset_uuid(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), __(), customize(), add_action() |
wp_is_block_theme() && has_action() && current_user_can() && !is_admin() && !->changeset_post_id() | 64–65 | wp_is_block_theme(), has_action(), current_user_can(), is_admin(), is_customize_preview(), ->changeset_post_id(), is_ssl(), is_customize_preview(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), __(), customize(), add_action() |
!wp_is_block_theme() && current_user_can() && !is_admin() | 65–66 | wp_is_block_theme(), current_user_can(), is_admin(), is_customize_preview(), is_ssl(), is_customize_preview(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), ->changeset_uuid(), changeset_uuid(), __(), customize(), add_action() |
!wp_is_block_theme() && current_user_can() && !is_admin() && ->changeset_uuid() | 65–66 | wp_is_block_theme(), current_user_can(), is_admin(), is_customize_preview(), is_ssl(), is_customize_preview(), ->changeset_uuid(), remove_query_arg(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), __(), customize(), add_action() |
wp_is_block_theme() && has_action() && current_user_can() && !is_admin() && !->changeset_post_id() && !->changeset_uuid() | 67–68 | wp_is_block_theme(), has_action(), current_user_can(), is_admin(), is_customize_preview(), ->changeset_post_id(), is_ssl(), is_customize_preview(), ->changeset_uuid(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), __(), customize(), add_action() |
!wp_is_block_theme() && current_user_can() && !is_admin() && !->changeset_uuid() | 68–69 | wp_is_block_theme(), current_user_can(), is_admin(), is_customize_preview(), is_ssl(), is_customize_preview(), ->changeset_uuid(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), ->changeset_uuid(), changeset_uuid(), __(), customize(), add_action() |
!wp_is_block_theme() && current_user_can() && !is_admin() && !->changeset_post_id() | 68–69 | wp_is_block_theme(), current_user_can(), is_admin(), is_customize_preview(), ->changeset_post_id(), is_ssl(), is_customize_preview(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), ->changeset_uuid(), changeset_uuid(), __(), customize(), add_action() |
!wp_is_block_theme() && current_user_can() && !is_admin() && !->changeset_post_id() && ->changeset_uuid() | 68–69 | wp_is_block_theme(), current_user_can(), is_admin(), is_customize_preview(), ->changeset_post_id(), is_ssl(), is_customize_preview(), ->changeset_uuid(), remove_query_arg(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), __(), customize(), add_action() |
wp_is_block_theme() && has_action() && current_user_can() && !is_admin() | 69–70 | wp_is_block_theme(), has_action(), current_user_can(), is_admin(), is_customize_preview(), is_ssl(), is_customize_preview(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), ->changeset_uuid(), changeset_uuid(), __(), customize(), add_action() |
wp_is_block_theme() && has_action() && current_user_can() && !is_admin() && ->changeset_uuid() | 69–70 | wp_is_block_theme(), has_action(), current_user_can(), is_admin(), is_customize_preview(), is_ssl(), is_customize_preview(), ->changeset_uuid(), remove_query_arg(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), __(), customize(), add_action() |
!wp_is_block_theme() && current_user_can() && !is_admin() && is_customize_preview() && !->changeset_post_id() && !->changeset_uuid() | 71–72 | wp_is_block_theme(), current_user_can(), is_admin(), is_customize_preview(), ->changeset_post_id(), is_ssl(), is_customize_preview(), ->changeset_uuid(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), ->changeset_uuid(), changeset_uuid(), __(), customize(), add_action() |
wp_is_block_theme() && has_action() && current_user_can() && !is_admin() && !->changeset_uuid() | 72–73 | wp_is_block_theme(), has_action(), current_user_can(), is_admin(), is_customize_preview(), is_ssl(), is_customize_preview(), ->changeset_uuid(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), ->changeset_uuid(), changeset_uuid(), __(), customize(), add_action() |
wp_is_block_theme() && has_action() && current_user_can() && !is_admin() && !->changeset_post_id() | 72–73 | wp_is_block_theme(), has_action(), current_user_can(), is_admin(), is_customize_preview(), ->changeset_post_id(), is_ssl(), is_customize_preview(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), ->changeset_uuid(), changeset_uuid(), __(), customize(), add_action() |
wp_is_block_theme() && has_action() && current_user_can() && !is_admin() && !->changeset_post_id() && ->changeset_uuid() | 72–73 | wp_is_block_theme(), has_action(), current_user_can(), is_admin(), is_customize_preview(), ->changeset_post_id(), is_ssl(), is_customize_preview(), ->changeset_uuid(), remove_query_arg(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), __(), customize(), add_action() |
!wp_is_block_theme() && current_user_can() && !is_admin() && ->changeset_uuid() | 73–74 | wp_is_block_theme(), current_user_can(), is_admin(), is_customize_preview(), is_ssl(), is_customize_preview(), ->changeset_uuid(), remove_query_arg(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), ->changeset_uuid(), changeset_uuid(), __(), customize(), add_action() |
!wp_is_block_theme() && current_user_can() && !is_admin() && ->changeset_post_id() | 73–74 | wp_is_block_theme(), current_user_can(), is_admin(), is_customize_preview(), ->changeset_post_id(), get_post_type_object(), ->changeset_post_id(), current_user_can(), is_ssl(), is_customize_preview(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), __(), customize(), add_action() |
wp_is_block_theme() && has_action() && current_user_can() && !is_admin() && is_customize_preview() && !->changeset_post_id() && !->changeset_uuid() | 75–76 | wp_is_block_theme(), has_action(), current_user_can(), is_admin(), is_customize_preview(), ->changeset_post_id(), is_ssl(), is_customize_preview(), ->changeset_uuid(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), ->changeset_uuid(), changeset_uuid(), __(), customize(), add_action() |
!wp_is_block_theme() && current_user_can() && !is_admin() && is_customize_preview() && !->changeset_post_id() && ->changeset_uuid() | 76–77 | wp_is_block_theme(), current_user_can(), is_admin(), is_customize_preview(), ->changeset_post_id(), is_ssl(), is_customize_preview(), ->changeset_uuid(), remove_query_arg(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), ->changeset_uuid(), changeset_uuid(), __(), customize(), add_action() |
!wp_is_block_theme() && current_user_can() && !is_admin() && ->changeset_post_id() && !->changeset_uuid() | 76–77 | wp_is_block_theme(), current_user_can(), is_admin(), is_customize_preview(), ->changeset_post_id(), get_post_type_object(), ->changeset_post_id(), current_user_can(), is_ssl(), is_customize_preview(), ->changeset_uuid(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), __(), customize(), add_action() |
wp_is_block_theme() && has_action() && current_user_can() && !is_admin() && ->changeset_uuid() | 77–78 | wp_is_block_theme(), has_action(), current_user_can(), is_admin(), is_customize_preview(), is_ssl(), is_customize_preview(), ->changeset_uuid(), remove_query_arg(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), ->changeset_uuid(), changeset_uuid(), __(), customize(), add_action() |
wp_is_block_theme() && has_action() && current_user_can() && !is_admin() && ->changeset_post_id() | 77–78 | wp_is_block_theme(), has_action(), current_user_can(), is_admin(), is_customize_preview(), ->changeset_post_id(), get_post_type_object(), ->changeset_post_id(), current_user_can(), is_ssl(), is_customize_preview(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), __(), customize(), add_action() |
wp_is_block_theme() && has_action() && current_user_can() && !is_admin() && is_customize_preview() && !->changeset_post_id() && ->changeset_uuid() | 80–81 | wp_is_block_theme(), has_action(), current_user_can(), is_admin(), is_customize_preview(), ->changeset_post_id(), is_ssl(), is_customize_preview(), ->changeset_uuid(), remove_query_arg(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), ->changeset_uuid(), changeset_uuid(), __(), customize(), add_action() |
wp_is_block_theme() && has_action() && current_user_can() && !is_admin() && ->changeset_post_id() && !->changeset_uuid() | 80–81 | wp_is_block_theme(), has_action(), current_user_can(), is_admin(), is_customize_preview(), ->changeset_post_id(), get_post_type_object(), ->changeset_post_id(), current_user_can(), is_ssl(), is_customize_preview(), ->changeset_uuid(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), __(), customize(), add_action() |
!wp_is_block_theme() && current_user_can() && !is_admin() && ->changeset_post_id() | 81–82 | wp_is_block_theme(), current_user_can(), is_admin(), is_customize_preview(), ->changeset_post_id(), get_post_type_object(), ->changeset_post_id(), current_user_can(), is_ssl(), is_customize_preview(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), ->changeset_uuid(), changeset_uuid(), __(), customize(), add_action() |
!wp_is_block_theme() && current_user_can() && !is_admin() && ->changeset_post_id() && ->changeset_uuid() | 81–82 | wp_is_block_theme(), current_user_can(), is_admin(), is_customize_preview(), ->changeset_post_id(), get_post_type_object(), ->changeset_post_id(), current_user_can(), is_ssl(), is_customize_preview(), ->changeset_uuid(), remove_query_arg(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), __(), customize(), add_action() |
!wp_is_block_theme() && current_user_can() && !is_admin() && is_customize_preview() && ->changeset_post_id() && !->changeset_uuid() | 84–85 | wp_is_block_theme(), current_user_can(), is_admin(), is_customize_preview(), ->changeset_post_id(), get_post_type_object(), ->changeset_post_id(), current_user_can(), is_ssl(), is_customize_preview(), ->changeset_uuid(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), ->changeset_uuid(), changeset_uuid(), __(), customize(), add_action() |
wp_is_block_theme() && has_action() && current_user_can() && !is_admin() && ->changeset_post_id() | 85–86 | wp_is_block_theme(), has_action(), current_user_can(), is_admin(), is_customize_preview(), ->changeset_post_id(), get_post_type_object(), ->changeset_post_id(), current_user_can(), is_ssl(), is_customize_preview(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), ->changeset_uuid(), changeset_uuid(), __(), customize(), add_action() |
wp_is_block_theme() && has_action() && current_user_can() && !is_admin() && ->changeset_post_id() && ->changeset_uuid() | 85–86 | wp_is_block_theme(), has_action(), current_user_can(), is_admin(), is_customize_preview(), ->changeset_post_id(), get_post_type_object(), ->changeset_post_id(), current_user_can(), is_ssl(), is_customize_preview(), ->changeset_uuid(), remove_query_arg(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), __(), customize(), add_action() |
wp_is_block_theme() && has_action() && current_user_can() && !is_admin() && is_customize_preview() && ->changeset_post_id() && !->changeset_uuid() | 88–89 | wp_is_block_theme(), has_action(), current_user_can(), is_admin(), is_customize_preview(), ->changeset_post_id(), get_post_type_object(), ->changeset_post_id(), current_user_can(), is_ssl(), is_customize_preview(), ->changeset_uuid(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), ->changeset_uuid(), changeset_uuid(), __(), customize(), add_action() |
!wp_is_block_theme() && current_user_can() && !is_admin() && is_customize_preview() && ->changeset_post_id() && ->changeset_uuid() | 89–90 | wp_is_block_theme(), current_user_can(), is_admin(), is_customize_preview(), ->changeset_post_id(), get_post_type_object(), ->changeset_post_id(), current_user_can(), is_ssl(), is_customize_preview(), ->changeset_uuid(), remove_query_arg(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), ->changeset_uuid(), changeset_uuid(), __(), customize(), add_action() |
wp_is_block_theme() && has_action() && current_user_can() && !is_admin() && is_customize_preview() && ->changeset_post_id() && ->changeset_uuid() | 93–94 | wp_is_block_theme(), has_action(), current_user_can(), is_admin(), is_customize_preview(), ->changeset_post_id(), get_post_type_object(), ->changeset_post_id(), current_user_can(), is_ssl(), is_customize_preview(), ->changeset_uuid(), remove_query_arg(), urlencode(), wp_customize_url(), add_query_arg(), is_customize_preview(), ->changeset_uuid(), changeset_uuid(), __(), customize(), add_action() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 98 | 10–94 | 11 | |
| 8.5 | 98 | 10–94 | 11 | |
| 8.4 | 98 | 10–94 | 11 | |
| 8.3 | 98 | 10–94 | 11 | |
| 8.2 | 98 | 10–94 | 11 | |
| 8.1 | 98 | 10–94 | 11 | 1 fewer instruction than PHP 7.4 |
| 7.4 | 99 | 10–95 | 11 |
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Uses · 12
- wp_is_block_theme()Returns whether the active theme is a block-based theme or not.
- has_action()Checks if any action has been registered for a hook.
- current_user_can()Returns whether the current user has the specified capability.
- is_admin()Determines whether the current request is for an administrative interface page.
- is_customize_preview()Whether the site is being previewed in the Customizer.
- get_post_type_object()Retrieves a post type object by name.
- is_ssl()Determines if SSL is used.
- remove_query_arg()Removes an item or items from a query string.
- add_query_arg()Retrieves a modified URL query string.
- wp_customize_url()Returns a URL to load the Customizer.
- __()Retrieves the translation of $text.
- add_action()Adds a callback function to an action hook.
Source code
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' );}Changelog
Introduced in 4.3.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, from
src/wp-includes/admin-bar.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.