wppaste
WordPress

twentyseventeen_customize_register( WP_Customize_Manager $wp_customize )

Source
wp-content/themes/twentyseventeen/inc/customizer.php:15
Adds postMessage support for site title and description for the Theme Customizer.

Compatibility

WordPress
core
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.

Parameters

$wp_customizeWP_Customize_Manager
Theme Customizer object.

Performance profile

How much work a call to twentyseventeen_customize_register() 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
Light

Touches nothing outside its own arguments.

Scaling
Scales with input

The body loops, so the work grows with what you pass in.

Instructions
134

Executed per call on PHP 8.5. The body compiles to 178.

Plugin surface
1 hook

Third-party callbacks on 'twentyseventeen_front_page_sections' run inside this call, and their cost is not bounded by anything here.

Called by
0

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

What it touches

  • hookthird-party callbacksapply_filters()called directly

Further down the call graph this can also reach query, option, cache, serialize and transient. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.

What one call costs · 1 distinct outcome

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

WhenInstructionsCalls it makes
!$i134->get_setting(), ->get_setting(), ->get_setting(), ->add_partial(), ->add_partial(), ->add_setting(), ->add_setting(), __(), __(), __(), __(), light(), __(), label(), ->add_control(), __(), title(), ->add_setting(), __(), __(), __(), __(), one-column(), apply_filters()

Across PHP versions

PHPCompiledExecutedBranchesNotes
8.6-dev17713421 fewer instruction than PHP 8.5
8.51781342
8.41781342
8.31781342
8.21781342
8.11781342
7.41781342

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.

Hooks and filters fired · 1

One hook fires while twentyseventeen_customize_register() runs, in this order:

  1. apply_filters( twentyseventeen_front_page_sections )filterline 126 (+111 into the body)

    Filters the number of front page sections in Twenty Seventeen.

Uses · 3

Source code

function twentyseventeen_customize_register( $wp_customize ) {	$wp_customize->get_setting( 'blogname' )->transport         = 'postMessage';	$wp_customize->get_setting( 'blogdescription' )->transport  = 'postMessage';	$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; 	$wp_customize->selective_refresh->add_partial(		'blogname',		array(			'selector'        => '.site-title a',			'render_callback' => 'twentyseventeen_customize_partial_blogname',		)	);	$wp_customize->selective_refresh->add_partial(		'blogdescription',		array(			'selector'        => '.site-description',			'render_callback' => 'twentyseventeen_customize_partial_blogdescription',		)	); 	/**	 * Custom colors.	 */	$wp_customize->add_setting(		'colorscheme',		array(			'default'           => 'light',			'transport'         => 'postMessage',			'sanitize_callback' => 'twentyseventeen_sanitize_colorscheme',		)	); 	$wp_customize->add_setting(		'colorscheme_hue',		array(			'default'           => 250,			'transport'         => 'postMessage',			'sanitize_callback' => 'absint', // The hue is stored as a positive integer.		)	); 	$wp_customize->add_control(		'colorscheme',		array(			'type'     => 'radio',			'label'    => __( 'Color Scheme', 'twentyseventeen' ),			'choices'  => array(				'light'  => __( 'Light', 'twentyseventeen' ),				'dark'   => __( 'Dark', 'twentyseventeen' ),				'custom' => __( 'Custom', 'twentyseventeen' ),			),			'section'  => 'colors',			'priority' => 5,		)	); 	$wp_customize->add_control(		new WP_Customize_Color_Control(			$wp_customize,			'colorscheme_hue',			array(				'label'    => __( 'Hue', 'twentyseventeen' ),				'mode'     => 'hue',				'section'  => 'colors',				'priority' => 6,			)		)	); 	/**	 * Theme options.	 */	$wp_customize->add_section(		'theme_options',		array(			'title'    => __( 'Theme Options', 'twentyseventeen' ),			'priority' => 130, // Before Additional CSS.		)	);

Changelog

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.1.0 tag, from src/wp-content/themes/twentyseventeen/inc/customizer.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.