get_theme_mods()
Retrieves all theme modifications.
Return
(array|void) Theme modifications.
More Information
This function will update the options for theme mods which were created in older WordPress versions that used the deprecated mods_$theme_name option key to now use theme_mod_$name.
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; }
Changelog
Version | Description |
---|---|
3.1.0 | Introduced. |
© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_theme_mods