get_random_header_image() WordPress Function

The get_random_header_image() function is a built-in function in WordPress that allows you to select a random image from your list of header images and display it on your website.

get_random_header_image() #

Gets random header image URL from registered images in theme.


Return

(string) Path to header image.


Top ↑

Source

File: wp-includes/theme.php

function get_random_header_image() {
	$random_image = _get_random_header_data();

	if ( empty( $random_image->url ) ) {
		return '';
	}

	return $random_image->url;
}


Top ↑

Changelog

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