background_image()WP 3.0.0

Display background image path.

1 time — 0.002051 sec (very slow) | 50000 times — 1.90 sec (fast) | PHP 7.2.5, WP 5.0

No Hooks.

Return

null. Nothing (null).

Usage

background_image();

Examples

0

#1 Display the URL in the css styles

<style>
	body.custom-background { 
		background-image: url( '<?php background_image(); ?>' ); 
	}
</style>

For more examples, see get_background_image().

Changelog

Since 3.0.0 Introduced.

background_image() code WP 6.4.3

function background_image() {
	echo get_background_image();
}