theme_mod_<name>

Filters the theme modification, or 'theme_mod', value.

Description

apply_filters( 'theme_mod_<name>', (string) $mods_name ); 

The dynamic portion(s) of the hook name refer to the key name of the modification array. For example, 'header_textcolor', header_image,, and so on depending on the theme options.

Parameters (1)

0. $mods_name (string)
The value of the current theme modification.

Usage

To run the hook, copy the example below.
  1. $mods_name = apply_filters( 'theme_mod_{$name}', $mods_name ); 
  2.  
  3. if ( !empty( $mods_name ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the theme_mod_<name> callback 
  2. function filter_theme_mod_name( $mods_name ) { 
  3. // make filter magic happen here... 
  4. return $mods_name
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( "theme_mod_{$name}", 'filter_theme_mod_name', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( "theme_mod_{$name}", 'filter_theme_mod_name', 10, 1 ); 

Defined (2)

The filter is defined in the following location(s).

/wp-includes/theme.php  
  1. return apply_filters( "theme_mod_{$name}", $mods[$name] ); 
  1. return apply_filters( "theme_mod_{$name}", $default );