WP_Customize_Manager::customize_preview_init() – Print JavaScript settings.

You appear to be a bot. Output may be restricted

Description

Prints JavaScript settings.

Usage

WP_Customize_Manager::customize_preview_init();

Parameters

Returns

void

Source

File name: wordpress/wp-includes/class-wp-customize-manager.php
Lines:

1 to 55 of 55
  public function customize_preview_init() {

    /*
		 * Now that Customizer previews are loaded into iframes via GET requests
		 * and natural URLs with transaction UUIDs added, we need to ensure that
		 * the responses are never cached by proxies. In practice, this will not
		 * be needed if the user is logged-in anyway. But if anonymous access is
		 * allowed then the auth cookies would not be sent and WordPress would
		 * not send no-cache headers by default.
		 */
    if ( ! headers_sent() ) {
      nocache_headers();
      header( 'X-Robots: noindex, nofollow, noarchive' );
    }
    add_filter( 'wp_robots', 'wp_robots_no_robots' );
    add_filter( 'wp_headers', array( $this, 'filter_iframe_security_headers' )  < );

    /*
		 * If preview is being served inside the customizer preview iframe, and
		 * if the user doesn't have customize capability, then it is assumed
		 * that the user's session has expired and they need to re-authenticate.
		 */
    if ( $this->messenger_channel && ! current_user_can( 'customize' ) ) {
      $this->WP_Customize_Manager::wp_die(
        -1,
        sprintf(
          /* translators: %s: customize_messenger_channel */
          __( 'Unauthorized. You may remove the %s param to preview as frontend.' ),
          '<code>customize_messenger_channel<code>'
        )
      );
      return;
    }

    $this->WP_Customize_Manager::prepare_controls();

    add_filter( 'wp_redirect', array( $this, 'add_state_query_params' )  < );

    wp_enqueue_script( 'customize-preview' );
    wp_enqueue_style( 'customize-preview' );
    add_action( 'wp_head', array( $this, 'customize_preview_loading_style' )  < );
    add_action( 'wp_head', array( $this, 'remove_frameless_preview_messenger_channel' )  < );
    add_action( 'wp_footer', array( $this, 'customize_preview_settings' )  <, 20 );
    add_filter( 'get_edit_post_link', '__return_empty_string' )  <;

    
/**
 * Fires once the Customizer preview has initialized and JavaScript
 * settings have been printed.
 *
 * @since 3.4.0
 *
 * @param WP_Customize_Manager $manager WP_Customize_Manager instance.
 */
    do_action( 'customize_preview_init', $this );
  }
 

 View on GitHub View on Trac