unregister_default_headers() WordPress Function

The unregister_default_headers() function allows you to remove default headers shipped with Wordpress. This is useful if you want to override the default headers with your own custom headers.

unregister_default_headers( string|array $header ) #

Unregisters default headers.


Description

This function must be called after register_default_headers() has already added the header you want to remove.

Top ↑

See also


Top ↑

Parameters

$header

(string|array)(Required)The header string id (key of array) to remove, or an array thereof.


Top ↑

Return

(bool|void) A single header returns true on success, false on failure. There is currently no return value for multiple headers.


Top ↑

Source

File: wp-includes/theme.php

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;
	}
}

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