Make WordPress Core

Ticket #59480: 59480.diff

File 59480.diff, 1.2 KB (added by nicolefurlan, 16 months ago)

Patch for #59480

  • src/wp-includes/class-wp-customize-manager.php

    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 { 
    20892089                ?>
    20902090                <script>
    20912091                ( function() {
    2092                         var urlParser, oldQueryParams, newQueryParams, i;
    20932092                        if ( parent !== window ) {
    20942093                                return;
    20952094                        }
    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 );
    21082099                        }
    21092100                } )();
    21102101                </script>