Skip to main content
WordPress made easy with the drag & drop Total WordPress Theme!Learn More

Custom Background Not Working In WordPress

Last updated on:
Custom Background Not Working In WordPress

I’ve gotten a couple questions already from people having issues with their custom background options in WordPress after upgrading to WordPress 3.3. In the past I didn’t use the <body_class() ?> function much in my themes as I never really made use of any of the classes added dynamically to the body tag. However, with WorPress 3.3 it is key since now the custom background function makes use of it.

In WordPress 3.3 when you add your custom background instead of applying the styling to your “body” tag as it did before it now adds a new class called “custom-background” and applies the css to that instead.

Example:

<style type="text/css">
body.custom-background { background-color: #921d1d; }
</style>

Since it applies the styling to that specific class you will need the custom-background class in your body tag.

The Fix

Open header.php and locate your <body> tag. Change to:

 <body <?php body_class(''); ?>>

Alternative “Fix”

Of course if you don’t want to have the extra classes you can always change the body tag to this (not recommended):

<body class="custom-background">
Subscribe to the Newsletter

Get our latest news, tutorials, guides, tips & deals delivered to your inbox.

6 Comments

  1. Ozhan

    Thank you for this short but great post. I have been struggling with this background problem. Helped a lot.

  2. Catzie

    Your alternative fix, though marked as not recommended, saved my day. Thanks.

  3. MarcC

    Thank you so much for this fix, scratched my head (and google’s) for long enough trying to fix the custom background image issue.

    Again, thank you.

  4. wordman

    Thank you, it’ realy good solve! I’am use and with my template it works! Great.

  5. sienagabrielle

    Thank you SO much! been trying to figure this out for an hour. So helpful.

  6. malipi (@malipi)

    Thanks, it helped me a lot! 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

Learn how your comment data is processed by viewing our privacy policy here.