Title: _custom_header_background_just_in_time
Published: April 25, 2014
Last modified: February 24, 2026

---

# _custom_header_background_just_in_time()

## In this article

 * [Source](https://developer.wordpress.org/reference/functions/_custom_header_background_just_in_time/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/_custom_header_background_just_in_time/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/_custom_header_background_just_in_time/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/_custom_header_background_just_in_time/?output_format=md#wp--skip-link--target)

This function’s access is marked private. This means it is not intended for use 
by plugin or theme developers, only by core. It is listed here for completeness.

Registers the internal custom header and background routines.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/_custom_header_background_just_in_time/?output_format=md#source)󠁿

    ```php
    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'] );
    		}
    	}
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/theme.php#L2963)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/theme.php#L2963-L2993)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/_custom_header_background_just_in_time/?output_format=md#related)󠁿

| Uses | Description | 
| [Custom_Image_Header::__construct()](https://developer.wordpress.org/reference/classes/custom_image_header/__construct/)`wp-admin/includes/class-custom-image-header.php` |

Constructor – Registers administration header callback.

  | 
| [Custom_Background::__construct()](https://developer.wordpress.org/reference/classes/custom_background/__construct/)`wp-admin/includes/class-custom-background.php` |

Constructor – Registers administration header callback.

  | 
| [add_theme_support()](https://developer.wordpress.org/reference/functions/add_theme_support/)`wp-includes/theme.php` |

Registers theme support for a given feature.

  | 
| [get_theme_support()](https://developer.wordpress.org/reference/functions/get_theme_support/)`wp-includes/theme.php` |

Gets the theme support arguments passed when registering that support.

  | 
| [current_theme_supports()](https://developer.wordpress.org/reference/functions/current_theme_supports/)`wp-includes/theme.php` |

Checks a theme’s support for a given feature.

  | 
| [is_admin()](https://developer.wordpress.org/reference/functions/is_admin/)`wp-includes/load.php` |

Determines whether the current request is for an administrative interface page.

  | 
| [add_action()](https://developer.wordpress.org/reference/functions/add_action/)`wp-includes/plugin.php` |

Adds a callback function to an action hook.

  |

[Show 3 more](https://developer.wordpress.org/reference/functions/_custom_header_background_just_in_time/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/_custom_header_background_just_in_time/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/_custom_header_background_just_in_time/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2F_custom_header_background_just_in_time%2F)
before being able to contribute a note or feedback.