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.
Merges [39546] to the 4.7 branch.
Fixes #39145.

Built from https://develop.svn.wordpress.org/branches/4.7@39568


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39508 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dion Hulse 2016-12-12 01:46:35 +00:00
parent 30bb628489
commit 6663e03ced

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' ) );