_custom_header_background_just_in_time()
- Since
- 3.4.0
- Source
wp-includes/theme.php:2955
Compatibility
- WordPress
- since 3.4.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.
Performance profile
How much work a call to _custom_header_background_just_in_time() 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
- 11–78
- 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 78.
Nothing here hands control to plugin code.
Nothing in core calls this; the cost is only what you spend yourself.
What it touches
- hookthird-party callbacks
apply_filters()one call below _custom_header_background_just_in_time()
Further down the call graph this can also reach query, option, cache, serialize and transient. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.
What one call costs · 6 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost _custom_header_background_just_in_time() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
!current_theme_supports() | 11 | current_theme_supports(), current_theme_supports() |
| always | 25–39 | current_theme_supports(), add_theme_support(), get_theme_support(), is_admin(), current_theme_supports() |
| always | 29–43 | current_theme_supports(), current_theme_supports(), add_theme_support(), get_theme_support(), add_action(), is_admin() |
| always | 32–46 | current_theme_supports(), add_theme_support(), get_theme_support(), add_action(), is_admin(), current_theme_supports() |
current_theme_supports() | 43–71 | current_theme_supports(), add_theme_support(), get_theme_support(), is_admin(), current_theme_supports(), add_theme_support(), get_theme_support(), add_action(), is_admin() |
current_theme_supports() | 50–78 | current_theme_supports(), add_theme_support(), get_theme_support(), add_action(), is_admin(), current_theme_supports(), add_theme_support(), get_theme_support(), add_action(), is_admin() |
Across PHP versions
Compiles the same on PHP 7.4, 8.1, 8.2, 8.3, 8.4, 8.5 and 8.6-dev: 78 instructions, 11–78 executed per call, 5 branches. The work does not change between versions.
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 · 7
- current_theme_supports()Checks a theme's support for a given feature.
- add_theme_support()Registers theme support for a given feature.
- get_theme_support()Gets the theme support arguments passed when registering that support.
- add_action()Adds a callback function to an action hook.
- is_admin()Determines whether the current request is for an administrative interface page.
- Custom_Image_Header::__construct()Constructor - Registers administration header callback.
- Custom_Background::__construct()Constructor - Registers administration header callback.
Source code
function _custom_header_background_just_in_time() { global $custom_image_header, $custom_background; if ( current_theme_supports( 'custom-header' ) ) { // In case any constants were defined after an add_custom_image_header() call, re-run. add_theme_support( 'custom-header', array( '__jit' => true ) ); $args = get_theme_support( 'custom-header' ); if ( $args[0]['wp-head-callback'] ) { add_action( 'wp_head', $args[0]['wp-head-callback'] ); } if ( is_admin() ) { require_once ABSPATH . 'wp-admin/includes/class-custom-image-header.php'; $custom_image_header = new Custom_Image_Header( $args[0]['admin-head-callback'], $args[0]['admin-preview-callback'] ); } } if ( current_theme_supports( 'custom-background' ) ) { // In case any constants were defined after an add_custom_background() call, re-run. add_theme_support( 'custom-background', array( '__jit' => true ) ); $args = get_theme_support( 'custom-background' ); add_action( 'wp_head', $args[0]['wp-head-callback'] ); if ( is_admin() ) { require_once ABSPATH . 'wp-admin/includes/class-custom-background.php'; $custom_background = new Custom_Background( $args[0]['admin-head-callback'], $args[0]['admin-preview-callback'] ); } }}Changelog
Introduced in 3.4.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/theme.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.