WordPress at Your Fingertips
function is not described

Custom_Image_Header::reset_header_image() public WP 3.4.0

Reset a header image to the default image for the theme.

This method does not do anything if the theme does not have a default header image.

{} It's a method of the class: Custom_Image_Header{}

No Hooks.

Return

null. Nothing.

Usage

$Custom_Image_Header = new Custom_Image_Header();
$Custom_Image_Header->reset_header_image();

Changelog

Since 3.4.0 Introduced.

Code of Custom_Image_Header::reset_header_image() WP 5.8.2

final public function reset_header_image() {
	$this->process_default_headers();
	$default = get_theme_support( 'custom-header', 'default-image' );

	if ( ! $default ) {
		$this->remove_header_image();
		return;
	}

	$default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() );

	$default_data = array();
	foreach ( $this->default_headers as $header => $details ) {
		if ( $details['url'] === $default ) {
			$default_data = $details;
			break;
		}
	}

	set_theme_mod( 'header_image', $default );
	set_theme_mod( 'header_image_data', (object) $default_data );
}