get_theme_mods()
get_theme_mods()
检索所有主题修改。
Retrieve all theme modifications.
返回(Return)
(array|void)主题修改。
源码(Source)
/** * Retrieve all theme modifications. * * @since 3.1.0 * * @return array|void 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" ); } } return $mods; }
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
3.1.0 | wp-includes/theme.php:890 | 3 | 6 |
笔记(Notes)
例子
get_theme_mods() 为WP2原创文章,链接:https://www.wp2.cn/functions/get_theme_mods/