Title: WP_Customize_Manager::customize_pane_settings
Published: December 9, 2015
Last modified: February 24, 2026

---

# WP_Customize_Manager::customize_pane_settings()

## In this article

 * [Source](https://developer.wordpress.org/reference/classes/wp_customize_manager/customize_pane_settings/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_customize_manager/customize_pane_settings/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_customize_manager/customize_pane_settings/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_customize_manager/customize_pane_settings/?output_format=md#wp--skip-link--target)

Prints JavaScript settings for parent window.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_customize_manager/customize_pane_settings/?output_format=md#source)󠁿

    ```php
    public function customize_pane_settings() {

    	$login_url = add_query_arg(
    		array(
    			'interim-login'   => 1,
    			'customize-login' => 1,
    		),
    		wp_login_url()
    	);

    	// Ensure dirty flags are set for modified settings.
    	foreach ( array_keys( $this->unsanitized_post_values() ) as $setting_id ) {
    		$setting = $this->get_setting( $setting_id );
    		if ( $setting ) {
    			$setting->dirty = true;
    		}
    	}

    	$autosave_revision_post  = null;
    	$autosave_autodraft_post = null;
    	$changeset_post_id       = $this->changeset_post_id();
    	if ( ! $this->saved_starter_content_changeset && ! $this->autosaved() ) {
    		if ( $changeset_post_id ) {
    			if ( is_user_logged_in() ) {
    				$autosave_revision_post = wp_get_post_autosave( $changeset_post_id, get_current_user_id() );
    			}
    		} else {
    			$autosave_autodraft_posts = $this->get_changeset_posts(
    				array(
    					'posts_per_page'            => 1,
    					'post_status'               => 'auto-draft',
    					'exclude_restore_dismissed' => true,
    				)
    			);
    			if ( ! empty( $autosave_autodraft_posts ) ) {
    				$autosave_autodraft_post = array_shift( $autosave_autodraft_posts );
    			}
    		}
    	}

    	$current_user_can_publish = current_user_can( get_post_type_object( 'customize_changeset' )->cap->publish_posts );

    	// @todo Include all of the status labels here from script-loader.php, and then allow it to be filtered.
    	$status_choices = array();
    	if ( $current_user_can_publish ) {
    		$status_choices[] = array(
    			'status' => 'publish',
    			'label'  => __( 'Publish' ),
    		);
    	}
    	$status_choices[] = array(
    		'status' => 'draft',
    		'label'  => __( 'Save Draft' ),
    	);
    	if ( $current_user_can_publish ) {
    		$status_choices[] = array(
    			'status' => 'future',
    			'label'  => _x( 'Schedule', 'customizer changeset action/button label' ),
    		);
    	}

    	// Prepare Customizer settings to pass to JavaScript.
    	$changeset_post = null;
    	if ( $changeset_post_id ) {
    		$changeset_post = get_post( $changeset_post_id );
    	}

    	// Determine initial date to be at present or future, not past.
    	$current_time = current_time( 'mysql', false );
    	$initial_date = $current_time;
    	if ( $changeset_post ) {
    		$initial_date = get_the_time( 'Y-m-d H:i:s', $changeset_post->ID );
    		if ( $initial_date < $current_time ) {
    			$initial_date = $current_time;
    		}
    	}

    	$lock_user_id = false;
    	if ( $this->changeset_post_id() ) {
    		$lock_user_id = wp_check_post_lock( $this->changeset_post_id() );
    	}

    	$settings = array(
    		'changeset'              => array(
    			'uuid'                  => $this->changeset_uuid(),
    			'branching'             => $this->branching(),
    			'autosaved'             => $this->autosaved(),
    			'hasAutosaveRevision'   => ! empty( $autosave_revision_post ),
    			'latestAutoDraftUuid'   => $autosave_autodraft_post ? $autosave_autodraft_post->post_name : null,
    			'status'                => $changeset_post ? $changeset_post->post_status : '',
    			'currentUserCanPublish' => $current_user_can_publish,
    			'publishDate'           => $initial_date,
    			'statusChoices'         => $status_choices,
    			'lockUser'              => $lock_user_id ? $this->get_lock_user_data( $lock_user_id ) : null,
    		),
    		'initialServerDate'      => $current_time,
    		'dateFormat'             => get_option( 'date_format' ),
    		'timeFormat'             => get_option( 'time_format' ),
    		'initialServerTimestamp' => floor( microtime( true ) * 1000 ),
    		'initialClientTimestamp' => -1, // To be set with JS below.
    		'timeouts'               => array(
    			'windowRefresh'           => 250,
    			'changesetAutoSave'       => AUTOSAVE_INTERVAL * 1000,
    			'keepAliveCheck'          => 2500,
    			'reflowPaneContents'      => 100,
    			'previewFrameSensitivity' => 2000,
    		),
    		'theme'                  => array(
    			'stylesheet'  => $this->get_stylesheet(),
    			'active'      => $this->is_theme_active(),
    			'_canInstall' => current_user_can( 'install_themes' ),
    		),
    		'url'                    => array(
    			'preview'       => sanitize_url( $this->get_preview_url() ),
    			'return'        => sanitize_url( $this->get_return_url() ),
    			'parent'        => sanitize_url( admin_url() ),
    			'activated'     => sanitize_url( home_url( '/' ) ),
    			'ajax'          => sanitize_url( admin_url( 'admin-ajax.php', 'relative' ) ),
    			'allowed'       => array_map( 'sanitize_url', $this->get_allowed_urls() ),
    			'isCrossDomain' => $this->is_cross_domain(),
    			'home'          => sanitize_url( home_url( '/' ) ),
    			'login'         => sanitize_url( $login_url ),
    		),
    		'browser'                => array(
    			'mobile' => wp_is_mobile(),
    			'ios'    => $this->is_ios(),
    		),
    		'panels'                 => array(),
    		'sections'               => array(),
    		'nonce'                  => $this->get_nonces(),
    		'autofocus'              => $this->get_autofocus(),
    		'documentTitleTmpl'      => $this->get_document_title_template(),
    		'previewableDevices'     => $this->get_previewable_devices(),
    		'l10n'                   => array(
    			'confirmDeleteTheme'   => __( 'Are you sure you want to delete this theme?' ),
    			/* translators: %d: Number of theme search results, which cannot currently consider singular vs. plural forms. */
    			'themeSearchResults'   => __( '%d themes found' ),
    			/* translators: %d: Number of themes being displayed, which cannot currently consider singular vs. plural forms. */
    			'announceThemeCount'   => __( 'Displaying %d themes' ),
    			/* translators: %s: Theme name. */
    			'announceThemeDetails' => __( 'Showing details for theme: %s' ),
    		),
    	);

    	// Temporarily disable installation in Customizer. See #42184.
    	$filesystem_method = get_filesystem_method();
    	ob_start();
    	$filesystem_credentials_are_stored = request_filesystem_credentials( self_admin_url() );
    	ob_end_clean();
    	if ( 'direct' !== $filesystem_method && ! $filesystem_credentials_are_stored ) {
    		$settings['theme']['_filesystemCredentialsNeeded'] = true;
    	}

    	// Prepare Customize Section objects to pass to JavaScript.
    	foreach ( $this->sections() as $id => $section ) {
    		if ( $section->check_capabilities() ) {
    			$settings['sections'][ $id ] = $section->json();
    		}
    	}

    	// Prepare Customize Panel objects to pass to JavaScript.
    	foreach ( $this->panels() as $panel_id => $panel ) {
    		if ( $panel->check_capabilities() ) {
    			$settings['panels'][ $panel_id ] = $panel->json();
    			foreach ( $panel->sections as $section_id => $section ) {
    				if ( $section->check_capabilities() ) {
    					$settings['sections'][ $section_id ] = $section->json();
    				}
    			}
    		}
    	}

    	ob_start();
    	?>
    	<script>
    		var _wpCustomizeSettings = <?php echo wp_json_encode( $settings, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ); ?>;
    		_wpCustomizeSettings.initialClientTimestamp = _.now();
    		_wpCustomizeSettings.controls = {};
    		_wpCustomizeSettings.settings = {};
    		<?php

    		// Serialize settings one by one to improve memory usage.
    		echo "(function ( s ){\n";
    		foreach ( $this->settings() as $setting ) {
    			if ( $setting->check_capabilities() ) {
    				printf(
    					"s[%s] = %s;\n",
    					wp_json_encode( $setting->id, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ),
    					wp_json_encode( $setting->json(), JSON_HEX_TAG | JSON_UNESCAPED_SLASHES )
    				);
    			}
    		}
    		echo "})( _wpCustomizeSettings.settings );\n";

    		// Serialize controls one by one to improve memory usage.
    		echo "(function ( c ){\n";
    		foreach ( $this->controls() as $control ) {
    			if ( $control->check_capabilities() ) {
    				printf(
    					"c[%s] = %s;\n",
    					wp_json_encode( $control->id, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ),
    					wp_json_encode( $control->json(), JSON_HEX_TAG | JSON_UNESCAPED_SLASHES )
    				);
    			}
    		}
    		echo "})( _wpCustomizeSettings.controls );\n";
    		?>
    	</script>
    	<?php
    	wp_print_inline_script_tag( wp_remove_surrounding_empty_script_tags( ob_get_clean() ) . "\n//# sourceURL=" . rawurlencode( __METHOD__ ) );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-customize-manager.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/class-wp-customize-manager.php#L4816)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/class-wp-customize-manager.php#L4816-L5026)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_customize_manager/customize_pane_settings/?output_format=md#related)󠁿

| Uses | Description | 
| [wp_remove_surrounding_empty_script_tags()](https://developer.wordpress.org/reference/functions/wp_remove_surrounding_empty_script_tags/)`wp-includes/script-loader.php` |

Removes leading and trailing _empty_ script tags.

  | 
| [wp_print_inline_script_tag()](https://developer.wordpress.org/reference/functions/wp_print_inline_script_tag/)`wp-includes/script-loader.php` |

Prints an inline script tag.

  | 
| [WP_Customize_Manager::get_lock_user_data()](https://developer.wordpress.org/reference/classes/wp_customize_manager/get_lock_user_data/)`wp-includes/class-wp-customize-manager.php` |

Gets lock user data.

  | 
| [WP_Customize_Manager::get_changeset_posts()](https://developer.wordpress.org/reference/classes/wp_customize_manager/get_changeset_posts/)`wp-includes/class-wp-customize-manager.php` |

Gets changeset posts.

  | 
| [WP_Customize_Manager::branching()](https://developer.wordpress.org/reference/classes/wp_customize_manager/branching/)`wp-includes/class-wp-customize-manager.php` |

Whether the changeset branching is allowed.

  | 
| [WP_Customize_Manager::autosaved()](https://developer.wordpress.org/reference/classes/wp_customize_manager/autosaved/)`wp-includes/class-wp-customize-manager.php` |

Gets whether data from a changeset’s autosaved revision should be loaded if it exists.

  | 
| [WP_Customize_Manager::get_allowed_urls()](https://developer.wordpress.org/reference/classes/wp_customize_manager/get_allowed_urls/)`wp-includes/class-wp-customize-manager.php` |

Gets URLs allowed to be previewed.

  | 
| [WP_Customize_Manager::is_cross_domain()](https://developer.wordpress.org/reference/classes/wp_customize_manager/is_cross_domain/)`wp-includes/class-wp-customize-manager.php` |

Determines whether the admin and the frontend are on different domains.

  | 
| [WP_Customize_Manager::changeset_post_id()](https://developer.wordpress.org/reference/classes/wp_customize_manager/changeset_post_id/)`wp-includes/class-wp-customize-manager.php` |

Gets the changeset post ID for the loaded changeset.

  | 
| [WP_Customize_Manager::changeset_uuid()](https://developer.wordpress.org/reference/classes/wp_customize_manager/changeset_uuid/)`wp-includes/class-wp-customize-manager.php` |

Gets the changeset UUID.

  | 
| [WP_Customize_Manager::get_nonces()](https://developer.wordpress.org/reference/classes/wp_customize_manager/get_nonces/)`wp-includes/class-wp-customize-manager.php` |

Gets nonces for the Customizer.

  | 
| [WP_Customize_Manager::get_previewable_devices()](https://developer.wordpress.org/reference/classes/wp_customize_manager/get_previewable_devices/)`wp-includes/class-wp-customize-manager.php` |

Returns a list of devices to allow previewing.

  | 
| [WP_Customize_Manager::get_preview_url()](https://developer.wordpress.org/reference/classes/wp_customize_manager/get_preview_url/)`wp-includes/class-wp-customize-manager.php` |

Gets the initial URL to be previewed.

  | 
| [WP_Customize_Manager::get_return_url()](https://developer.wordpress.org/reference/classes/wp_customize_manager/get_return_url/)`wp-includes/class-wp-customize-manager.php` |

Gets URL to link the user to when closing the Customizer.

  | 
| [WP_Customize_Manager::get_autofocus()](https://developer.wordpress.org/reference/classes/wp_customize_manager/get_autofocus/)`wp-includes/class-wp-customize-manager.php` |

Gets the autofocused constructs.

  | 
| [WP_Customize_Manager::is_ios()](https://developer.wordpress.org/reference/classes/wp_customize_manager/is_ios/)`wp-includes/class-wp-customize-manager.php` |

Determines whether the user agent is iOS.

  | 
| [WP_Customize_Manager::get_document_title_template()](https://developer.wordpress.org/reference/classes/wp_customize_manager/get_document_title_template/)`wp-includes/class-wp-customize-manager.php` |

Gets the template string for the Customizer pane document title.

  | 
| [WP_Customize_Manager::unsanitized_post_values()](https://developer.wordpress.org/reference/classes/wp_customize_manager/unsanitized_post_values/)`wp-includes/class-wp-customize-manager.php` |

Gets dirty pre-sanitized setting values in the current customized state.

  | 
| [WP_Customize_Manager::panels()](https://developer.wordpress.org/reference/classes/wp_customize_manager/panels/)`wp-includes/class-wp-customize-manager.php` |

Gets the registered panels.

  | 
| [wp_check_post_lock()](https://developer.wordpress.org/reference/functions/wp_check_post_lock/)`wp-admin/includes/post.php` |

Determines whether the post is currently being edited by another user.

  | 
| [get_filesystem_method()](https://developer.wordpress.org/reference/functions/get_filesystem_method/)`wp-admin/includes/file.php` |

Determines which method to use for reading, writing, modifying, or deleting files on the filesystem.

  | 
| [request_filesystem_credentials()](https://developer.wordpress.org/reference/functions/request_filesystem_credentials/)`wp-admin/includes/file.php` |

Displays a form to the user to request for their FTP/SSH details in order to connect to the filesystem.

  | 
| [WP_Customize_Manager::get_setting()](https://developer.wordpress.org/reference/classes/wp_customize_manager/get_setting/)`wp-includes/class-wp-customize-manager.php` |

Retrieves a customize setting.

  | 
| [WP_Customize_Manager::get_stylesheet()](https://developer.wordpress.org/reference/classes/wp_customize_manager/get_stylesheet/)`wp-includes/class-wp-customize-manager.php` |

Retrieves the stylesheet name of the previewed theme.

  | 
| [WP_Customize_Manager::is_theme_active()](https://developer.wordpress.org/reference/classes/wp_customize_manager/is_theme_active/)`wp-includes/class-wp-customize-manager.php` |

Checks if the current theme is active.

  | 
| [WP_Customize_Manager::sections()](https://developer.wordpress.org/reference/classes/wp_customize_manager/sections/)`wp-includes/class-wp-customize-manager.php` |

Gets the registered sections.

  | 
| [WP_Customize_Manager::settings()](https://developer.wordpress.org/reference/classes/wp_customize_manager/settings/)`wp-includes/class-wp-customize-manager.php` |

Gets the registered settings.

  | 
| [WP_Customize_Manager::controls()](https://developer.wordpress.org/reference/classes/wp_customize_manager/controls/)`wp-includes/class-wp-customize-manager.php` |

Gets the registered controls.

  | 
| [get_the_time()](https://developer.wordpress.org/reference/functions/get_the_time/)`wp-includes/general-template.php` |

Retrieves the time of the post.

  | 
| [wp_login_url()](https://developer.wordpress.org/reference/functions/wp_login_url/)`wp-includes/general-template.php` |

Retrieves the login URL.

  | 
| [wp_is_mobile()](https://developer.wordpress.org/reference/functions/wp_is_mobile/)`wp-includes/vars.php` |

Test if the current browser runs on a mobile device (smart phone, tablet, etc.).

  | 
| [current_time()](https://developer.wordpress.org/reference/functions/current_time/)`wp-includes/functions.php` |

Retrieves the current time based on specified type.

  | 
| [self_admin_url()](https://developer.wordpress.org/reference/functions/self_admin_url/)`wp-includes/link-template.php` |

Retrieves the URL to the admin area for either the current site or the network depending on context.

  | 
| [wp_get_post_autosave()](https://developer.wordpress.org/reference/functions/wp_get_post_autosave/)`wp-includes/revision.php` |

Retrieves the autosaved data of the specified post.

  | 
| [wp_json_encode()](https://developer.wordpress.org/reference/functions/wp_json_encode/)`wp-includes/functions.php` |

Encodes a variable into JSON, with some confidence checks.

  | 
| [current_user_can()](https://developer.wordpress.org/reference/functions/current_user_can/)`wp-includes/capabilities.php` |

Returns whether the current user has the specified capability.

  | 
| [__()](https://developer.wordpress.org/reference/functions/__/)`wp-includes/l10n.php` |

Retrieves the translation of $text.

  | 
| [_x()](https://developer.wordpress.org/reference/functions/_x/)`wp-includes/l10n.php` |

Retrieves translated string with gettext context.

  | 
| [is_user_logged_in()](https://developer.wordpress.org/reference/functions/is_user_logged_in/)`wp-includes/pluggable.php` |

Determines whether the current visitor is a logged in user.

  | 
| [sanitize_url()](https://developer.wordpress.org/reference/functions/sanitize_url/)`wp-includes/formatting.php` |

Sanitizes a URL for database or redirect usage.

  | 
| [add_query_arg()](https://developer.wordpress.org/reference/functions/add_query_arg/)`wp-includes/functions.php` |

Retrieves a modified URL query string.

  | 
| [admin_url()](https://developer.wordpress.org/reference/functions/admin_url/)`wp-includes/link-template.php` |

Retrieves the URL to the admin area for the current site.

  | 
| [home_url()](https://developer.wordpress.org/reference/functions/home_url/)`wp-includes/link-template.php` |

Retrieves the URL for the current site where the front end is accessible.

  | 
| [get_option()](https://developer.wordpress.org/reference/functions/get_option/)`wp-includes/option.php` |

Retrieves an option value based on an option name.

  | 
| [get_current_user_id()](https://developer.wordpress.org/reference/functions/get_current_user_id/)`wp-includes/user.php` |

Gets the current user’s ID.

  | 
| [get_post_type_object()](https://developer.wordpress.org/reference/functions/get_post_type_object/)`wp-includes/post.php` |

Retrieves a post type object by name.

  | 
| [get_post()](https://developer.wordpress.org/reference/functions/get_post/)`wp-includes/post.php` |

Retrieves post data given a post ID or post object.

  |

[Show 42 more](https://developer.wordpress.org/reference/classes/wp_customize_manager/customize_pane_settings/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/wp_customize_manager/customize_pane_settings/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_customize_manager/customize_pane_settings/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_customize_manager%2Fcustomize_pane_settings%2F)
before being able to contribute a note or feedback.