Adding Wordpress Custom Background Image Feature

Add background header image in wordpress theme

Adding WordPress Custom Background Image is a new functionality that has been added since wordpress version 3.4. With this feature a wordpress user can easily add any images for a website background and colour without knowing any coding standard.

To add WordPress Custom Background Image feature in any WordPress Theme, simply add this below code in your theme functions.php file and save it:

$args = array(
'default-color' => '000000',
'default-image' => get_template_directory_uri() . '/images/background.jpg',
add_theme_support( 'custom-background', $args );


  1. ‘default-color’ => ‘000000’, (Default Background colour is BLACK)
  2. ‘default-image’ => get_template_directory_uri() . ‘/images/background.jpg’, (Default background image name is background.jpg which is located inside the theme images folder.)

Extra Argument that you can use are:

$args = array(
'default-color' => '',
'default-image' => '',
'default-repeat' => '',
'default-position-x' => '',
'default-attachment' => '',
'wp-head-callback' => '_custom_background_cb',
'admin-head-callback' => '',
'admin-preview-callback' => ''
add_theme_support( 'custom-background', $args );

Published by

Emdad Khan

I am Emdad Khan, A WordPress Theme Developer and Author of BN Web Design Website. A full time Freelancer on WordPress Theme Development & Optimization as well as blogger.

Leave a Reply