Ticket #45484: 45484.diff
File 45484.diff, 2.7 KB (added by , 6 years ago) |
---|
-
src/wp-includes/class-wp-customize-manager.php
1523 1523 1524 1524 // Options. 1525 1525 foreach ( $options as $name => $value ) { 1526 if ( preg_match( '/^{{(?P<symbol>.+)}}$/', $value, $matches ) ) { 1526 1527 // Serialize values for search. 1528 $value = maybe_serialize( $value ); 1529 1530 if ( preg_match( '/s:\d+:"{{(?P<symbol>.+)}}"/', $value, $matches ) ) { 1527 1531 if ( isset( $posts[ $matches['symbol'] ] ) ) { 1528 $ value= $posts[ $matches['symbol'] ]['ID'];1532 $symbol_match = $posts[ $matches['symbol'] ]['ID']; 1529 1533 } elseif ( isset( $attachment_ids[ $matches['symbol'] ] ) ) { 1530 $value = $attachment_ids[ $matches['symbol'] ]; 1534 $symbol_match = $attachment_ids[ $matches['symbol'] ]; 1535 } 1536 1537 // If we have any symbol matches, update the values. 1538 if ( isset( $symbol_match ) ) { 1539 1540 // Replace found string matches with post ID ints. 1541 $value = str_replace( $matches[0], "i:{$symbol_match}", $value ); 1531 1542 } else { 1532 1543 continue; 1533 1544 } 1534 1545 } 1535 1546 1547 // Unserialize values after checking for post symbols, so they can be properly referenced. 1548 $value = maybe_unserialize( $value ); 1549 1536 1550 if ( empty( $changeset_data[ $name ] ) || ! empty( $changeset_data[ $name ]['starter_content'] ) ) { 1537 1551 $this->set_post_value( $name, $value ); 1538 1552 $this->pending_starter_content_settings_ids[] = $name; … … 1541 1555 1542 1556 // Theme mods. 1543 1557 foreach ( $theme_mods as $name => $value ) { 1544 if ( preg_match( '/^{{(?P<symbol>.+)}}$/', $value, $matches ) ) { 1558 1559 // Serialize values for search. 1560 $value = maybe_serialize( $value ); 1561 1562 if ( preg_match( '/s:\d+:"{{(?P<symbol>.+)}}"/', $value, $matches ) ) { 1545 1563 if ( isset( $posts[ $matches['symbol'] ] ) ) { 1546 $ value= $posts[ $matches['symbol'] ]['ID'];1564 $symbol_match = $posts[ $matches['symbol'] ]['ID']; 1547 1565 } elseif ( isset( $attachment_ids[ $matches['symbol'] ] ) ) { 1548 $value = $attachment_ids[ $matches['symbol'] ]; 1566 $symbol_match = $attachment_ids[ $matches['symbol'] ]; 1567 } 1568 1569 // If we have any symbol matches, update the values. 1570 if ( isset( $symbol_match ) ) { 1571 1572 // Replace found string matches with post ID ints. 1573 $value = str_replace( $matches[0], "i:{$symbol_match}", $value ); 1549 1574 } else { 1550 1575 continue; 1551 1576 } 1552 1577 } 1553 1578 1579 // Unserialize values after checking for post symbols, so they can be properly referenced. 1580 $value = maybe_unserialize( $value ); 1581 1554 1582 // Handle header image as special case since setting has a legacy format. 1555 1583 if ( 'header_image' === $name ) { 1556 1584 $name = 'header_image_data';