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

---

# Custom_Background::init()

## In this article

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

Sets up the hooks for the Custom Background admin page.

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

    ```php
    public function init() {
    	$page = add_theme_page(
    		_x( 'Background', 'custom background' ),
    		_x( 'Background', 'custom background' ),
    		'edit_theme_options',
    		'custom-background',
    		array( $this, 'admin_page' )
    	);

    	if ( ! $page ) {
    		return;
    	}

    	add_action( "load-{$page}", array( $this, 'admin_load' ) );
    	add_action( "load-{$page}", array( $this, 'take_action' ), 49 );
    	add_action( "load-{$page}", array( $this, 'handle_upload' ), 49 );

    	if ( $this->admin_header_callback ) {
    		add_action( "admin_head-{$page}", $this->admin_header_callback, 51 );
    	}
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/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#L68)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-admin/includes/class-custom-background.php#L68-L88)

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

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

Adds a submenu page to the Appearance main menu.

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

Retrieves translated string with gettext context.

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

Adds a callback function to an action hook.

  |

[Show 1 more](https://developer.wordpress.org/reference/classes/custom_background/init/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/custom_background/init/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/custom_background/init/?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%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fcustom_background%2Finit%2F)
before being able to contribute a note or feedback.