Title: Custom_Background::__construct
Published: April 25, 2014
Last modified: August 20, 2026

---

# Custom_Background::__construct( callable $admin_header_callback = `''`, callable $admin_image_div_callback = `''` )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/custom_background/__construct/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/classes/custom_background/__construct/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/custom_background/__construct/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/custom_background/__construct/?output_format=md#changelog)

Constructor – Registers administration header callback.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/custom_background/__construct/?output_format=md#parameters)󠁿

 `$admin_header_callback`callableoptional

Administration header callback.

Default:`''`

`$admin_image_div_callback`callableoptional

Custom image div output callback.

Default:`''`

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

    ```php
    public function __construct( $admin_header_callback = '', $admin_image_div_callback = '' ) {
    	$this->admin_header_callback    = $admin_header_callback;
    	$this->admin_image_div_callback = $admin_image_div_callback;

    	add_action( 'admin_menu', array( $this, 'init' ) );

    	add_action( 'wp_ajax_custom-background-add', array( $this, 'ajax_background_add' ) );

    	// Unused since 3.5.0.
    	add_action( 'wp_ajax_set-background-image', array( $this, 'wp_set_background_image' ) );
    }
    ```

[View all references](https://developer.wordpress.org/reference/file/wp-admin/includes/class-custom-background.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-admin/includes/class-custom-background.php#L51)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-admin/includes/class-custom-background.php#L51-L61)

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

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

Adds a callback function to an action hook.

  |

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

Registers the internal custom header and background routines.

  |

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

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

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fsummer-heart-0930.chufeiyun1688.workers.dev%3A443%2Fhttps%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fcustom_background%2F__construct%2F)
before being able to contribute a note or feedback.