WordPress.org

Make WordPress Core

Ticket #39145: 39145.diff

File 39145.diff, 596 bytes (added by tyxla, 6 weeks ago)

Use esc_url() instead of wp_json_encode() for custom background image URL

  • src/wp-includes/theme.php

     
    15541554        $style = $color ? "background-color: #$color;" : ''; 
    15551555 
    15561556        if ( $background ) { 
    1557                 $image = " background-image: url(" . wp_json_encode( $background ) . ");"; 
     1557                $image = " background-image: url(" . esc_url( $background ) . ");"; 
    15581558 
    15591559                // Background Position. 
    15601560                $position_x = get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) );