iframe_header( string $title = '', bool $deprecated = false )
- Since
- 2.7.0
- Source
wp-admin/includes/template.php:2128
Compatibility
- WordPress
- since 2.7.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
$titlestringoptional- Title of the Iframe page. Default empty.Default:
'' $deprecatedbooloptional- Not used.Default:
false
Performance profile
How much work a call to iframe_header() 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
- Heavy
- Scaling
- Constant
- Instructions
- 167–170
- Plugin surface
- 8 hooks
- Called by
- 2
Reaches the database via get_user_by().
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 171.
Third-party callbacks on 'admin_enqueue_scripts', 'admin_print_styles-{$hook_suffix}', 'admin_print_styles' run inside this call, and their cost is not bounded by anything here.
2 places in core call this, so the cost is paid more often than your own code shows.
What it touches
- optionoption read or write
get_option()called directly - hookthird-party callbacks
do_action()called directly - cacheobject cache
wp_cache_get()one call below iframe_header() - serializeserialisation
maybe_unserialize()one call below iframe_header() - querycontent query
get_user_by()one call below iframe_header()
Further down the call graph this can also reach transient. That is the worst case, several calls deep and usually down an error path, not what a normal call pays.
What one call costs · 1 distinct outcome
One number would be a lie: the work depends on which branch runs. These are every distinct cost iframe_header() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
| always | 167–170 | show_admin_bar(), get_current_screen(), get_option(), get_option(), header(), _wp_admin_html_begin(), bloginfo(), _e(), wp_enqueue_style(), admin_url(), esc_js(), esc_js(), esc_js(), esc_js(), esc_js(), esc_js(), is_rtl(), do_action(), do_action(), do_action(), do_action(), do_action(), do_action(), do_action(), get_user_locale(), strtolower(), sanitize_html_class(), get_user_option(), sanitize_html_class(), is_rtl(), apply_filters(), ltrim(), esc_attr() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 171 | 167–170 | 2 | |
| 8.5 | 171 | 167–170 | 2 | |
| 8.4 | 171 | 167–170 | 2 | 6 fewer instructions than PHP 8.3 |
| 8.3 | 177 | 173–176 | 2 | |
| 8.2 | 177 | 173–176 | 2 | |
| 8.1 | 177 | 173–176 | 2 | 1 fewer instruction than PHP 7.4 |
| 7.4 | 178 | 173–177 | 2 |
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.
Hooks and filters fired · 8
8 hooks fire while iframe_header() runs, in this order:
- do_action( admin_enqueue_scripts )actionline 2157 (+29 into the body)
Fires when enqueuing scripts for all admin pages.
- do_action( admin_print_styles-{$hook_suffix} )actionline 2160 (+32 into the body)
Fires when styles are printed for a specific admin page based on $hook_suffix.
- do_action( admin_print_styles )actionline 2163 (+35 into the body)
Fires when styles are printed for all admin pages.
- do_action( admin_print_scripts-{$hook_suffix} )actionline 2166 (+38 into the body)
Fires when scripts are printed for a specific admin page based on $hook_suffix.
- do_action( admin_print_scripts )actionline 2169 (+41 into the body)
Fires when scripts are printed for all admin pages.
- do_action( admin_head-{$hook_suffix} )actionline 2172 (+44 into the body)
Fires in head section for a specific admin page.
- do_action( admin_head )actionline 2175 (+47 into the body)
Fires in head section for all admin pages.
- apply_filters( admin_body_class )filterline 2190 (+62 into the body)
Filters the CSS classes for the body tag in the admin.
Uses · 16
- show_admin_bar()Sets the display status of the admin bar.
- get_current_screen()Get the current screen object
- get_option()Retrieves an option value based on an option name.
- _wp_admin_html_begin()Prints out the beginning of the admin HTML header.
- bloginfo()Displays information about the current site.
- _e()Displays translated text.
- wp_enqueue_style()Enqueues a CSS stylesheet.
- esc_js()Escapes single quotes, `"`, ``, `&`, and fixes line endings.
- admin_url()Retrieves the URL to the admin area for the current site.
- is_rtl()Determines whether the current locale is right-to-left (RTL).
- do_action()Calls the callback functions that have been added to an action hook.
- sanitize_html_class()Sanitizes an HTML classname to ensure it only contains valid characters.
Show all 16
- get_user_locale()Retrieves the locale of a user.
- get_user_option()Retrieves user option that can be either per Site or per Network.
- apply_filters()Calls the callback functions that have been added to a filter hook.
- esc_attr()Escaping for HTML attributes.
Used by · 2
- install_plugin_information()Displays plugin information in dialog box form.
- install_theme_information()Displays theme information in dialog box form.
Source code
function iframe_header( $title = '', $deprecated = false ) { global $hook_suffix, $admin_body_class, $body_id, $wp_locale; show_admin_bar( false ); $admin_body_class = preg_replace( '/[^a-z0-9_-]+/i', '-', $hook_suffix ); $current_screen = get_current_screen(); header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) ); _wp_admin_html_begin(); ?><title><?php bloginfo( 'name' ); ?> › <?php echo $title; ?> — <?php _e( 'WordPress' ); ?></title> <?php wp_enqueue_style( 'colors' ); ?><script>addLoadEvent = function(func){if(typeof jQuery!=='undefined')jQuery(function(){func();});else if(typeof wpOnload!=='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};function tb_close(){var win=window.dialogArguments||opener||parent||top;win.tb_remove();}var ajaxurl = '<?php echo esc_js( admin_url( 'admin-ajax.php', 'relative' ) ); ?>', pagenow = '<?php echo esc_js( $current_screen->id ); ?>', typenow = '<?php echo esc_js( $current_screen->post_type ); ?>', adminpage = '<?php echo esc_js( $admin_body_class ); ?>', thousandsSeparator = '<?php echo esc_js( $wp_locale->number_format['thousands_sep'] ); ?>', decimalPoint = '<?php echo esc_js( $wp_locale->number_format['decimal_point'] ); ?>', isRtl = <?php echo (int) is_rtl(); ?>;</script> <?php /** This action is documented in wp-admin/admin-header.php */ do_action( 'admin_enqueue_scripts', $hook_suffix ); /** This action is documented in wp-admin/admin-header.php */ do_action( "admin_print_styles-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores /** This action is documented in wp-admin/admin-header.php */ do_action( 'admin_print_styles' ); /** This action is documented in wp-admin/admin-header.php */ do_action( "admin_print_scripts-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores /** This action is documented in wp-admin/admin-header.php */ do_action( 'admin_print_scripts' ); /** This action is documented in wp-admin/admin-header.php */ do_action( "admin_head-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores /** This action is documented in wp-admin/admin-header.php */ do_action( 'admin_head' ); $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) ); $admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'modern' ); if ( is_rtl() ) { $admin_body_class .= ' rtl'; } ?></head> <?php $admin_body_id = isset( $body_id ) ? 'id="' . $body_id . '" ' : ''; /** This filter is documented in wp-admin/admin-header.php */ $admin_body_classes = apply_filters( 'admin_body_class', '' ); $admin_body_classes = ltrim( $admin_body_classes . ' ' . $admin_body_class ); ?><body <?php echo $admin_body_id; ?>class="wp-admin wp-core-ui no-js iframe <?php echo esc_attr( $admin_body_classes ); ?>"><script>(function(){var c = document.body.className;c = c.replace(/no-js/, 'js');document.body.className = c;})();</script> <?php}Changelog
Introduced in 2.7.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-admin/includes/template.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.