From 1c9c709e8a39c66ffa2b8de4c172d295afcb2594 Mon Sep 17 00:00:00 2001 From: nacin Date: Fri, 2 Apr 2010 03:15:18 +0000 Subject: [PATCH] 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: http://svn.automattic.com/wordpress/trunk@13928 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/theme.php | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/wp-includes/theme.php b/wp-includes/theme.php index 64051f723..a34d4433b 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -1352,12 +1352,36 @@ function add_custom_image_header($header_callback, $admin_header_callback, $admi * * @since 3.0.0 * - * @param array $headers Array of headers keyed by a string id. The ids point to arrays containing 'url', 'thumbnail_url', and 'description' keys. + * @param array $headers Array of headers keyed by a string id. The ids point to arrays containing 'url', 'thumbnail_url', and 'description' keys. */ 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; + } } /**