get_theme_mods()
Retrieve all theme modifications.
Description Description
Return Return
(array|void) Theme modifications.
Source Source
File: wp-includes/theme.php
function get_theme_mods() {
$theme_slug = get_option( 'stylesheet' );
$mods = get_option( "theme_mods_$theme_slug" );
if ( false === $mods ) {
$theme_name = get_option( 'current_theme' );
if ( false === $theme_name ) {
$theme_name = wp_get_theme()->get( 'Name' );
}
$mods = get_option( "mods_$theme_name" ); // Deprecated location.
if ( is_admin() && false !== $mods ) {
update_option( "theme_mods_$theme_slug", $mods );
delete_option( "mods_$theme_name" );
}
}
return $mods;
}
Expand full source code Collapse full source code View on Trac
Changelog Changelog
| Version | Description |
|---|---|
| 3.1.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
Example
$mods = get_theme_mods(); var_dump( $mods ); // output example: // array(2) { ["header_textcolor"]=> string(3) "333" ["header_image"]=> string(20) "random-default-image" } var_dump( $mods['header_textcolor'] ); // output example: // string(3) "333"