WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru WPmentor - Ищем топовых специалистов по WordPress, чтобы помочь вам заработать
функция не описана

WP_Customize_Manager::remove_frameless_preview_messenger_channel() WP 4.7.0

Remove customize_messenger_channel query parameter from the preview window when it is not in an iframe.

This ensures that the admin bar will be shown. It also ensures that link navigation will work as expected since the parent frame is not being sent the URL to navigate to.

Это метод класса: WP_Customize_Manager

Хуков нет.

Возвращает

Null. Ничего.

Использование

$WP_Customize_Manager = new WP_Customize_Manager();
$var = $WP_Customize_Manager->remove_frameless_preview_messenger_channel();

Список изменений

С версии 4.7.0 Введена.

Код WP Customize Manager::remove frameless preview messenger channel: wp-includes/class-wp-customize-manager.php WP 5.4

<?php
public function remove_frameless_preview_messenger_channel() {
	if ( ! $this->messenger_channel ) {
		return;
	}
	?>
	<script>
	( function() {
		var urlParser, oldQueryParams, newQueryParams, i;
		if ( parent !== window ) {
			return;
		}
		urlParser = document.createElement( 'a' );
		urlParser.href = location.href;
		oldQueryParams = urlParser.search.substr( 1 ).split( /&/ );
		newQueryParams = [];
		for ( i = 0; i < oldQueryParams.length; i += 1 ) {
			if ( ! /^customize_messenger_channel=/.test( oldQueryParams[ i ] ) ) {
				newQueryParams.push( oldQueryParams[ i ] );
			}
		}
		urlParser.search = newQueryParams.join( '&' );
		if ( urlParser.search !== location.search ) {
			location.replace( urlParser.href );
		}
	} )();
	</script>
	<?php
}