diff --git src/wp-includes/class-wp-customize-manager.php src/wp-includes/class-wp-customize-manager.php
index d047620..ee3865d 100644
|
|
|
final class WP_Customize_Manager {
|
| 1353 | 1353 | |
| 1354 | 1354 | wp_enqueue_script( 'customize-preview' ); |
| 1355 | 1355 | add_action( 'wp_head', array( $this, 'customize_preview_loading_style' ) ); |
| | 1356 | if ( $this->messenger_channel ) { |
| | 1357 | add_action( 'wp_head', array( $this, 'remove_frameless_preview_messenger_channel' ) ); |
| | 1358 | } |
| 1356 | 1359 | add_action( 'wp_footer', array( $this, 'customize_preview_settings' ), 20 ); |
| 1357 | 1360 | add_filter( 'get_edit_post_link', '__return_empty_string' ); |
| 1358 | 1361 | |
| … |
… |
final class WP_Customize_Manager {
|
| 1488 | 1491 | } |
| 1489 | 1492 | |
| 1490 | 1493 | /** |
| | 1494 | * Remove customize_messenger_channel query parameter from the preview window when it is not in an iframe. |
| | 1495 | * |
| | 1496 | * This ensures that the admin bar will be shown. It also ensures that link navigation will |
| | 1497 | * work as expected since the parent frame is not being sent the URL to navigate to. |
| | 1498 | * |
| | 1499 | * @since 4.7.0 |
| | 1500 | * @access public |
| | 1501 | */ |
| | 1502 | public function remove_frameless_preview_messenger_channel( ){ |
| | 1503 | if ( ! $this->messenger_channel ) { |
| | 1504 | return; |
| | 1505 | } |
| | 1506 | ?> |
| | 1507 | <script> |
| | 1508 | ( function() { |
| | 1509 | var urlParser, oldQueryParams, newQueryParams, i; |
| | 1510 | if ( parent !== window ) { |
| | 1511 | return; |
| | 1512 | } |
| | 1513 | urlParser = document.createElement( 'a' ); |
| | 1514 | urlParser.href = location.href; |
| | 1515 | oldQueryParams = urlParser.search.substr( 1 ).split( /&/ ); |
| | 1516 | newQueryParams = []; |
| | 1517 | for ( i = 0; i < oldQueryParams.length; i += 1 ) { |
| | 1518 | if ( ! /^customize_messenger_channel=/.test( oldQueryParams[ i ] ) ) { |
| | 1519 | newQueryParams.push( oldQueryParams[ i ] ); |
| | 1520 | } |
| | 1521 | } |
| | 1522 | urlParser.search = newQueryParams.join( '&' ); |
| | 1523 | if ( urlParser.search !== location.search ) { |
| | 1524 | location.replace( urlParser.href ); |
| | 1525 | } |
| | 1526 | } )(); |
| | 1527 | </script> |
| | 1528 | <?php |
| | 1529 | } |
| | 1530 | |
| | 1531 | /** |
| 1491 | 1532 | * Print JavaScript settings for preview frame. |
| 1492 | 1533 | * |
| 1493 | 1534 | * @since 3.4.0 |