has_custom_header() WordPress Function

The has_custom_header() function in WordPress allows you to check if a custom header image has been set for the current theme. This can be useful if you want to conditionally display different content on your website based on whether or not a custom header image has been set.

has_custom_header() #

Checks whether a custom header is set or not.


Return

(bool) True if a custom header is set. False if not.


Top ↑

Source

File: wp-includes/theme.php

function has_custom_header() {
	if ( has_header_image() || ( has_header_video() && is_header_video_active() ) ) {
		return true;
	}

	return false;
}


Top ↑

Changelog

Changelog
VersionDescription
4.7.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