wpseek.com
WordPress开发者和主题制作者的搜索引擎



get_theme_mods › WordPress Function

Since3.1.0
已弃用n/a
get_theme_mods ( 没有参数 )
返回:
  • (array) Theme modifications.
定义在:
文档:
Change Log:
  • 5.9.0

Retrieves all theme modifications.



源码

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" );
		}
	}

	if ( ! is_array( $mods ) ) {
		$mods = array();
	}

	return $mods;
}