Changeset 39694 for branches/4.7/src/wp-includes/theme.php
- Timestamp:
- 01/05/2017 08:14:56 AM (8 years ago)
- Location:
- branches/4.7
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.7
-
branches/4.7/src/wp-includes/theme.php
r39693 r39694 1654 1654 if ( $post_id > 0 && get_post( $post_id ) ) { 1655 1655 $post = get_post( $post_id ); 1656 } else { 1656 } 1657 1658 // `-1` indicates no post exists; no query necessary. 1659 if ( ! $post && -1 !== $post_id ) { 1657 1660 $query = new WP_Query( $custom_css_query_vars ); 1658 1661 $post = $query->post; 1659 1662 /* 1660 * Cache the lookup. See WP_Customize_Custom_CSS_Setting::update().1663 * Cache the lookup. See wp_update_custom_css_post(). 1661 1664 * @todo This should get cleared if a custom_css post is added/removed. 1662 1665 */ 1663 if ( $post ) { 1664 set_theme_mod( 'custom_css_post_id', $post->ID ); 1665 } elseif ( -1 !== $post_id ) { 1666 set_theme_mod( 'custom_css_post_id', -1 ); 1667 } 1666 set_theme_mod( 'custom_css_post_id', $post ? $post->ID : -1 ); 1668 1667 } 1669 1668 } else { … … 1789 1788 $r = wp_insert_post( wp_slash( $post_data ), true ); 1790 1789 1791 // Trigger creation of a revision. This should be removed once #30854 is resolved. 1792 if ( ! is_wp_error( $r ) && 0 === count( wp_get_post_revisions( $r ) ) ) { 1793 wp_save_post_revision( $r ); 1790 if ( ! is_wp_error( $r ) ) { 1791 if ( get_stylesheet() === $args['stylesheet'] ) { 1792 set_theme_mod( 'custom_css_post_id', $r ); 1793 } 1794 1795 // Trigger creation of a revision. This should be removed once #30854 is resolved. 1796 if ( 0 === count( wp_get_post_revisions( $r ) ) ) { 1797 wp_save_post_revision( $r ); 1798 } 1794 1799 } 1795 1800 }
Note: See TracChangeset
for help on using the changeset viewer.