WordPress at a glance

get_theme_mods() WP 1.0

Retrieve all theme modifications.

Works based on: get_option()
✈ 1 time = 0.001737s = very slow | 50000 times = 2.25s = fast | PHP 7.0.32, WP 5.0.3

No Hooks.

Return

Array/null. Theme modifications.

Usage

get_theme_mods();

Code of get theme mods: wp-includes/theme.php VER 5.1.1

<?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;
}

Related Functions

From tag: Theme Modification API (theme mods options settings)

More from category: Other Theme Functions

No comments
    Hello, !     Log In . Register