Ticket #15048: 15048.admin.diff
| File 15048.admin.diff, 2.4 KB (added by , 15 years ago) |
|---|
-
wp-includes/theme.php
1298 1298 } 1299 1299 1300 1300 /** 1301 * Retrieve all theme modifications. 1302 * 1303 * @since 3.1.0 1304 * 1305 * @return mixed Theme modifications value. 1306 */ 1307 function 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 /** 1301 1321 * Retrieve theme modification value for the current theme. 1302 1322 * 1303 1323 * If the modification name does not exist, then the $default will be passed … … 1313 1333 * @return string 1314 1334 */ 1315 1335 function get_theme_mod($name, $default = false) { 1316 $ theme = get_current_theme();1336 $mods = get_theme_mods(); 1317 1337 1318 $mods = get_option( "mods_$theme" );1319 1320 1338 if ( isset($mods[$name]) ) 1321 1339 return apply_filters( "theme_mod_$name", $mods[$name] ); 1322 1340 … … 1332 1350 * @param string $value theme modification value. 1333 1351 */ 1334 1352 function set_theme_mod($name, $value) { 1335 $ theme = get_current_theme();1353 $mods = get_theme_mods(); 1336 1354 1337 $mods = get_option("mods_$theme");1338 1339 1355 $mods[$name] = $value; 1340 1356 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' ); 1343 1360 } 1344 1361 1345 1362 /** … … 1354 1371 * @return null 1355 1372 */ 1356 1373 function remove_theme_mod( $name ) { 1357 $ theme = get_current_theme();1374 $mods = get_theme_mods(); 1358 1375 1359 $mods = get_option("mods_$theme");1360 1361 1376 if ( !isset($mods[$name]) ) 1362 1377 return; 1363 1378 … … 1366 1381 if ( empty($mods) ) 1367 1382 return remove_theme_mods(); 1368 1383 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' ); 1371 1387 } 1372 1388 1373 1389 /** … … 1376 1392 * @since 2.1.0 1377 1393 */ 1378 1394 function 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() ); 1382 1397 } 1383 1398 1384 1399 /**