wppaste
WordPress

WP_Customize_Manager::customize_pane_settings()

Since
4.4.0
Source
wp-includes/class-wp-customize-manager.php:4816
Prints JavaScript settings for parent window.

Compatibility

WordPress
since 4.4.0
PHP
7.4–8.6-dev
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.

Performance profile

How much work a call to WP_Customize_Manager::customize_pane_settings() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.

Cost class
Heavy

Reaches the database via get_post().

Scaling
Scales with input

The body loops, so the work grows with how much data it finds.

Instructions
263–281

Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 425.

Plugin surface
None

Nothing here hands control to plugin code.

Called by
0

Nothing in core calls this; the cost is only what you spend yourself.

What it touches

  • querycontent queryget_post()called directly
  • optionoption read or writeget_option()called directly
  • hookthird-party callbacksapply_filters()one call below WP_Customize_Manager::customize_pane_settings()
  • cacheobject cachewp_cache_get()one call below WP_Customize_Manager::customize_pane_settings()
  • serializeserialisationmaybe_unserialize()one call below WP_Customize_Manager::customize_pane_settings()

Further down the call graph this can also reach transient. That is the worst case, several calls deep and usually down an error path, not what a normal call pays.

What one call costs · 4 distinct outcomes

One number would be a lie: the work depends on which branch runs. These are every distinct cost WP_Customize_Manager::customize_pane_settings() can have, taken from its control-flow graph on PHP 8.5.

WhenInstructionsCalls it makes
array_keys() && !->changeset_post_id()263–273wp_login_url(), add_query_arg(), ->unsanitized_post_values(), array_keys(), ->changeset_post_id(), get_post_type_object(), current_user_can(), __(), current_time(), ->changeset_post_id(), ->changeset_uuid(), ->branching(), ->autosaved(), get_option(), get_option(), microtime(), floor(), ->get_stylesheet(), ->is_theme_active(), current_user_can(), ->get_preview_url(), sanitize_url(), ->get_return_url(), sanitize_url(), admin_url(), sanitize_url(), home_url(), sanitize_url(), admin_url(), sanitize_url(), ->get_allowed_urls(), array_map(), ->is_cross_domain(), home_url(), sanitize_url(), sanitize_url(), wp_is_mobile(), ->is_ios(), ->get_nonces(), ->get_autofocus(), ->get_document_title_template(), ->get_previewable_devices(), __(), __(), __(), __(), get_filesystem_method(), ob_start(), self_admin_url(), request_filesystem_credentials(), ob_end_clean(), ->sections(), ->panels(), ob_start(), wp_json_encode(), ->settings(), ->controls(), ob_get_clean(), wp_remove_surrounding_empty_script_tags(), wp_print_inline_script_tag()
array_keys() && !->changeset_post_id()267–277wp_login_url(), add_query_arg(), ->unsanitized_post_values(), array_keys(), ->changeset_post_id(), get_post_type_object(), current_user_can(), __(), current_time(), ->changeset_post_id(), ->changeset_uuid(), ->branching(), ->autosaved(), ->get_lock_user_data(), get_option(), get_option(), microtime(), floor(), ->get_stylesheet(), ->is_theme_active(), current_user_can(), ->get_preview_url(), sanitize_url(), ->get_return_url(), sanitize_url(), admin_url(), sanitize_url(), home_url(), sanitize_url(), admin_url(), sanitize_url(), ->get_allowed_urls(), array_map(), ->is_cross_domain(), home_url(), sanitize_url(), sanitize_url(), wp_is_mobile(), ->is_ios(), ->get_nonces(), ->get_autofocus(), ->get_document_title_template(), ->get_previewable_devices(), __(), __(), __(), __(), get_filesystem_method(), ob_start(), self_admin_url(), request_filesystem_credentials(), ob_end_clean(), ->sections(), ->panels(), ob_start(), wp_json_encode(), ->settings(), ->controls(), ob_get_clean(), wp_remove_surrounding_empty_script_tags(), wp_print_inline_script_tag()
array_keys() && ->changeset_post_id()269–277wp_login_url(), add_query_arg(), ->unsanitized_post_values(), array_keys(), ->changeset_post_id(), get_post_type_object(), current_user_can(), __(), current_time(), ->changeset_post_id(), ->changeset_post_id(), wp_check_post_lock(), ->changeset_uuid(), ->branching(), ->autosaved(), get_option(), get_option(), microtime(), floor(), ->get_stylesheet(), ->is_theme_active(), current_user_can(), ->get_preview_url(), sanitize_url(), ->get_return_url(), sanitize_url(), admin_url(), sanitize_url(), home_url(), sanitize_url(), admin_url(), sanitize_url(), ->get_allowed_urls(), array_map(), ->is_cross_domain(), home_url(), sanitize_url(), sanitize_url(), wp_is_mobile(), ->is_ios(), ->get_nonces(), ->get_autofocus(), ->get_document_title_template(), ->get_previewable_devices(), __(), __(), __(), __(), get_filesystem_method(), ob_start(), self_admin_url(), request_filesystem_credentials(), ob_end_clean(), ->sections(), ->panels(), ob_start(), wp_json_encode(), ->settings(), ->controls(), ob_get_clean(), wp_remove_surrounding_empty_script_tags(), wp_print_inline_script_tag()
array_keys() && ->changeset_post_id()273–281wp_login_url(), add_query_arg(), ->unsanitized_post_values(), array_keys(), ->changeset_post_id(), get_post_type_object(), current_user_can(), __(), current_time(), ->changeset_post_id(), ->changeset_post_id(), wp_check_post_lock(), ->changeset_uuid(), ->branching(), ->autosaved(), ->get_lock_user_data(), get_option(), get_option(), microtime(), floor(), ->get_stylesheet(), ->is_theme_active(), current_user_can(), ->get_preview_url(), sanitize_url(), ->get_return_url(), sanitize_url(), admin_url(), sanitize_url(), home_url(), sanitize_url(), admin_url(), sanitize_url(), ->get_allowed_urls(), array_map(), ->is_cross_domain(), home_url(), sanitize_url(), sanitize_url(), wp_is_mobile(), ->is_ios(), ->get_nonces(), ->get_autofocus(), ->get_document_title_template(), ->get_previewable_devices(), __(), __(), __(), __(), get_filesystem_method(), ob_start(), self_admin_url(), request_filesystem_credentials(), ob_end_clean(), ->sections(), ->panels(), ob_start(), wp_json_encode(), ->settings(), ->controls(), ob_get_clean(), wp_remove_surrounding_empty_script_tags(), wp_print_inline_script_tag()

This body has more branch combinations than are worth enumerating, so the table covers the outcomes found first rather than every one that exists.

Across PHP versions

PHPCompiledExecutedBranchesNotes
8.6-dev426263–280341 more instruction than PHP 8.5
8.5425263–28134
8.4425263–28134
8.3425263–28134
8.2425263–28134
8.1425263–281343 fewer instructions than PHP 7.4
7.4428264–28234

An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.

Uses · 47

Show all 47

Source code

	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() );

Changelog

Introduced in 4.4.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.0.4 tag, from src/wp-includes/class-wp-customize-manager.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.