Customize: Use esc_url_raw() instead of wp_json_encode() to eliminate extraneous slashes when outputting background image URL in CSS url().

Props tyxla, westonruter.
See #22058.
Fixes #39145.


git-svn-id: https://develop.svn.wordpress.org/trunk@39546 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Weston Ruter 2016-12-09 01:42:23 +00:00
parent 9c5d1f6011
commit c8eafed944

View File

@ -1554,7 +1554,7 @@ function _custom_background_cb() {
$style = $color ? "background-color: #$color;" : ''; $style = $color ? "background-color: #$color;" : '';
if ( $background ) { if ( $background ) {
$image = " background-image: url(" . wp_json_encode( $background ) . ");"; $image = ' background-image: url("' . esc_url_raw( $background ) . '");';
// Background Position. // Background Position.
$position_x = get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ); $position_x = get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) );