Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/get theme mod


Retrieves a modification setting for the current theme. Along with set_theme_mod() this function can sometimes offer theme developers a simpler alternative to the Settings API when there is a need to handle basic theme-specific settings.

If the modification name does not exist, then the $default will be passed through sprintf() with the first string the template directory URI and the second string the stylesheet directory URI.


<?php get_theme_mod$name$default ); ?>


(string) (required) Theme modification name.
Default: None
(boolean|string) (optional)
Default: false

Return Values



Calling the Custom Background Color

This example could be used to add the custom background color as a border on the top of the footer. It would be css inserted in the header:

.footer {
     border-top: solid 1px #<?php echo get_theme_mod( 'background_color' ); ?>;


Change Log

Since: 2.1.0

Source File

get_theme_mod() is located in wp-includes/theme.php.


background_color(), set_theme_mod(), get_theme_mod(), get_theme_mods(), remove_theme_mod(), remove_theme_mods()

See also index of Function Reference and index of Template Tags.