X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/ef91a7f4f3c6468973e192335a27ec0e0faca0b5..e3ff8f35458a959c1879c0a4976701ed8dcfe651:/wp-includes/theme.php diff --git a/wp-includes/theme.php b/wp-includes/theme.php index 8aac86c9..84fdd23a 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -1554,7 +1554,7 @@ function _custom_background_cb() { $style = $color ? "background-color: #$color;" : ''; if ( $background ) { - $image = " background-image: url(" . wp_json_encode( $background ) . ");"; + $image = ' background-image: url("' . esc_url_raw( $background ) . '");'; // Background Position. $position_x = get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ); @@ -1643,7 +1643,8 @@ function wp_get_custom_css_post( $stylesheet = '' ) { 'no_found_rows' => true, 'cache_results' => true, 'update_post_meta_cache' => false, - 'update_term_meta_cache' => false, + 'update_post_term_cache' => false, + 'lazy_load_term_meta' => false, ); $post = null; @@ -1652,18 +1653,17 @@ function wp_get_custom_css_post( $stylesheet = '' ) { if ( $post_id > 0 && get_post( $post_id ) ) { $post = get_post( $post_id ); - } else { + } + + // `-1` indicates no post exists; no query necessary. + if ( ! $post && -1 !== $post_id ) { $query = new WP_Query( $custom_css_query_vars ); $post = $query->post; /* - * Cache the lookup. See WP_Customize_Custom_CSS_Setting::update(). + * Cache the lookup. See wp_update_custom_css_post(). * @todo This should get cleared if a custom_css post is added/removed. */ - if ( $post ) { - set_theme_mod( 'custom_css_post_id', $post->ID ); - } elseif ( -1 !== $post_id ) { - set_theme_mod( 'custom_css_post_id', -1 ); - } + set_theme_mod( 'custom_css_post_id', $post ? $post->ID : -1 ); } } else { $query = new WP_Query( $custom_css_query_vars ); @@ -1787,9 +1787,15 @@ function wp_update_custom_css_post( $css, $args = array() ) { } else { $r = wp_insert_post( wp_slash( $post_data ), true ); - // Trigger creation of a revision. This should be removed once #30854 is resolved. - if ( ! is_wp_error( $r ) && 0 === count( wp_get_post_revisions( $r ) ) ) { - wp_save_post_revision( $r ); + if ( ! is_wp_error( $r ) ) { + if ( get_stylesheet() === $args['stylesheet'] ) { + set_theme_mod( 'custom_css_post_id', $r ); + } + + // Trigger creation of a revision. This should be removed once #30854 is resolved. + if ( 0 === count( wp_get_post_revisions( $r ) ) ) { + wp_save_post_revision( $r ); + } } } @@ -1965,7 +1971,12 @@ function get_theme_starter_content() { ) ), ), 'nav_menus' => array( - 'page_home' => array( + 'link_home' => array( + 'type' => 'custom', + 'title' => _x( 'Home', 'Theme starter content' ), + 'url' => home_url(), + ), + 'page_home' => array( // Deprecated in favor of home_link. 'type' => 'post_type', 'object' => 'page', 'object_id' => '{{home}}',