WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/06/2010 09:00:17 PM (9 years ago)
Author:
nacin
Message:

Shift theme mods to be reliant on the theme slug instead of name. fixes #15048.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/theme.php

    r15720 r15736  
    12991299
    13001300/**
     1301 * Retrieve all theme modifications.
     1302 *
     1303 * @since 3.1.0
     1304 *
     1305 * @return mixed Theme modifications value.
     1306 */
     1307function get_theme_mods() {
     1308    $theme_slug = get_option( 'stylesheet' );
     1309    if ( false === ( $mods = get_option( "theme_mods_$theme_slug" ) ) ) {
     1310        $theme_name = get_current_theme();
     1311        $mods = get_option( "mods_$theme_name" );
     1312        if ( is_admin() && false !== $mods ) {
     1313            update_option( "theme_mods_$theme_slug", $mods );
     1314            delete_option( "mods_$theme_name" );
     1315        }
     1316    }
     1317    return $mods;
     1318}
     1319
     1320/**
    13011321 * Retrieve theme modification value for the current theme.
    13021322 *
     
    13141334 */
    13151335function get_theme_mod($name, $default = false) {
    1316     $theme = get_current_theme();
    1317 
    1318     $mods = get_option( "mods_$theme" );
     1336    $mods = get_theme_mods();
    13191337
    13201338    if ( isset($mods[$name]) )
     
    13331351 */
    13341352function set_theme_mod($name, $value) {
    1335     $theme = get_current_theme();
    1336 
    1337     $mods = get_option("mods_$theme");
     1353    $mods = get_theme_mods();
    13381354
    13391355    $mods[$name] = $value;
    13401356
    1341     update_option("mods_$theme", $mods);
    1342     wp_cache_delete("mods_$theme", 'options');
     1357    $theme = get_option( 'stylesheet' );
     1358    update_option( "theme_mods_$theme", $mods );
     1359    wp_cache_delete( "theme_mods_$theme", 'options' );
    13431360}
    13441361
     
    13551372 */
    13561373function remove_theme_mod( $name ) {
    1357     $theme = get_current_theme();
    1358 
    1359     $mods = get_option("mods_$theme");
     1374    $mods = get_theme_mods();
    13601375
    13611376    if ( !isset($mods[$name]) )
     
    13671382        return remove_theme_mods();
    13681383
    1369     update_option("mods_$theme", $mods);
    1370     wp_cache_delete("mods_$theme", 'options');
     1384    $theme = get_option( 'stylesheet' );
     1385    update_option( "theme_mods_$theme", $mods );
     1386    wp_cache_delete( "theme_mods_$theme", 'options' );
    13711387}
    13721388
     
    13771393 */
    13781394function remove_theme_mods() {
    1379     $theme = get_current_theme();
    1380 
    1381     delete_option("mods_$theme");
     1395    delete_option( 'theme_mods_' . get_option( 'stylesheet' ) );
     1396    delete_option( 'mods_' . get_current_theme() );
    13821397}
    13831398
Note: See TracChangeset for help on using the changeset viewer.