diff --git a/src/wp-includes/class-wp-customize-manager.php b/src/wp-includes/class-wp-customize-manager.php
index aebcfeb892..1265131f75 100644
a
|
b
|
final class WP_Customize_Manager { |
2089 | 2089 | ?> |
2090 | 2090 | <script> |
2091 | 2091 | ( function() { |
2092 | | var urlParser, oldQueryParams, newQueryParams, i; |
2093 | 2092 | if ( parent !== window ) { |
2094 | 2093 | return; |
2095 | 2094 | } |
2096 | | urlParser = document.createElement( 'a' ); |
2097 | | urlParser.href = location.href; |
2098 | | oldQueryParams = urlParser.search.substr( 1 ).split( /&/ ); |
2099 | | newQueryParams = []; |
2100 | | for ( i = 0; i < oldQueryParams.length; i += 1 ) { |
2101 | | if ( ! /^customize_messenger_channel=/.test( oldQueryParams[ i ] ) ) { |
2102 | | newQueryParams.push( oldQueryParams[ i ] ); |
2103 | | } |
2104 | | } |
2105 | | urlParser.search = newQueryParams.join( '&' ); |
2106 | | if ( urlParser.search !== location.search ) { |
2107 | | location.replace( urlParser.href ); |
| 2095 | const url = new URL( location.href ); |
| 2096 | if ( url.searchParams.has( 'customize_messenger_channel' ) ) { |
| 2097 | url.searchParams.delete( 'customize_messenger_channel' ); |
| 2098 | location.replace( url ); |
2108 | 2099 | } |
2109 | 2100 | } )(); |
2110 | 2101 | </script> |