register_default_headers() WordPress Function

The register_default_headers() function is used to register default headers for a theme. This function should be called in the theme's functions.php file. The function takes an array of header images as its only parameter. The array should be keyed by the header image file name, and the value should be an array of header image data. The header image data array can contain the following keys: 'url', 'thumbnail_url', and 'description'.

register_default_headers( array $headers ) #

Registers a selection of default headers to be displayed by the custom header admin UI.


Parameters

$headers

(array)(Required)Array of headers keyed by a string ID. The IDs point to arrays containing 'url', 'thumbnail_url', and 'description' keys.


Top ↑

More Information

  • The parameter $headers is required to merge with already registered headers.
  • This function is needed in order to use custom headers. The header image(s) must first be registered before using it.

Top ↑

Source

File: wp-includes/theme.php

function register_default_headers( $headers ) {
	global $_wp_default_headers;

	$_wp_default_headers = array_merge( (array) $_wp_default_headers, (array) $headers );
}

Top ↑

Changelog

Changelog
VersionDescription
3.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More