Child theme support for theme header registrations. Second call to register_theme_headers() should add more headers, not replace existing headers. add unregister_theme_headers(). props jorbin. see #12343
git-svn-id: https://develop.svn.wordpress.org/trunk@13928 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
10f1daf8e3
commit
9dab120905
|
@ -1357,7 +1357,31 @@ function add_custom_image_header($header_callback, $admin_header_callback, $admi
|
|||
function register_default_headers( $headers ) {
|
||||
global $_wp_default_headers;
|
||||
|
||||
$_wp_default_headers = $headers;
|
||||
$_wp_default_headers = array_merge( (array) $_wp_default_headers, (array) $headers );
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister default headers.
|
||||
*
|
||||
* This function must be called after register_default_headers() has already added the
|
||||
* header you want to remove.
|
||||
*
|
||||
* @see register_default_headers()
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param string|array The header string id (key of array) to remove, or an array thereof.
|
||||
* @return True on success, false on failure.
|
||||
*/
|
||||
function unregister_default_headers( $header ) {
|
||||
global $_wp_default_headers;
|
||||
if ( is_array( $header ) ) {
|
||||
array_map( 'unregister_default_headers', $header );
|
||||
} elseif ( isset( $_wp_default_headers[ $header ] ) ) {
|
||||
unset( $_wp_default_headers[ $header ] );
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue