WP_Customize_Manager::wp_loaded()
- Since
- 3.4.0
- Source
wp-includes/class-wp-customize-manager.php:917
Compatibility
- WordPress
- since 3.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::wp_loaded() 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
- Scaling
- Scales with input
- Instructions
- 60–69
- Plugin surface
- 1 hook
- Called by
- 0
Touches nothing outside its own arguments.
The body loops, so the work grows with how much data it finds.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 72.
Third-party callbacks on 'customize_register' run inside this call, and their cost is not bounded by anything here.
Nothing in core calls this; the cost is only what you spend yourself.
What it touches
- hookthird-party callbacks
do_action()called directly
What one call costs · 3 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost WP_Customize_Manager::wp_loaded() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
!->is_preview() | 60–64 | ->register_panel_type(), ->register_panel_type(), ->register_section_type(), ->register_section_type(), ->register_section_type(), ->register_control_type(), ->register_control_type(), ->register_control_type(), ->register_control_type(), ->register_control_type(), ->register_control_type(), ->register_control_type(), ->register_control_type(), ->register_control_type(), ->register_control_type(), ->register_control_type(), do_action(), ->settings_previewed(), ->is_preview() |
->is_preview() && is_admin() | 63–67 | ->register_panel_type(), ->register_panel_type(), ->register_section_type(), ->register_section_type(), ->register_section_type(), ->register_control_type(), ->register_control_type(), ->register_control_type(), ->register_control_type(), ->register_control_type(), ->register_control_type(), ->register_control_type(), ->register_control_type(), ->register_control_type(), ->register_control_type(), ->register_control_type(), do_action(), ->settings_previewed(), ->is_preview(), is_admin() |
->is_preview() && !is_admin() | 65–69 | ->register_panel_type(), ->register_panel_type(), ->register_section_type(), ->register_section_type(), ->register_section_type(), ->register_control_type(), ->register_control_type(), ->register_control_type(), ->register_control_type(), ->register_control_type(), ->register_control_type(), ->register_control_type(), ->register_control_type(), ->register_control_type(), ->register_control_type(), ->register_control_type(), do_action(), ->settings_previewed(), ->is_preview(), is_admin(), ->customize_preview_init() |
Across PHP versions
Compiles the same on PHP 7.4, 8.1, 8.2, 8.3, 8.4, 8.5 and 8.6-dev: 72 instructions, 60–69 executed per call, 5 branches. The work does not change between versions.
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 WP_Customize_Manager::wp_loaded() runs, in this order:
- do_action( customize_register )actionline 947 (+30 into the body)
Fires once WordPress has loaded, allowing scripts and styles to be initialized.
Uses · 8
- do_action()Calls the callback functions that have been added to an action hook.
- is_admin()Determines whether the current request is for an administrative interface page.
- WP_Customize_Manager::register_panel_type()Registers a customize panel type.
- WP_Customize_Manager::register_section_type()Registers a customize section type.
- WP_Customize_Manager::register_control_type()Registers a customize control type.
- WP_Customize_Manager::settings_previewed()Gets whether settings are or will be previewed.
- WP_Customize_Manager::is_preview()Determines whether it is a theme preview or not.
- WP_Customize_Manager::customize_preview_init()Prints JavaScript settings.
Source code
public function wp_loaded() { /* * Unconditionally register core types for panels, sections, and controls * in case plugin unhooks all customize_register actions. */ $this->register_panel_type( 'WP_Customize_Panel' ); $this->register_panel_type( 'WP_Customize_Themes_Panel' ); $this->register_section_type( 'WP_Customize_Section' ); $this->register_section_type( 'WP_Customize_Sidebar_Section' ); $this->register_section_type( 'WP_Customize_Themes_Section' ); $this->register_control_type( 'WP_Customize_Color_Control' ); $this->register_control_type( 'WP_Customize_Media_Control' ); $this->register_control_type( 'WP_Customize_Upload_Control' ); $this->register_control_type( 'WP_Customize_Image_Control' ); $this->register_control_type( 'WP_Customize_Background_Image_Control' ); $this->register_control_type( 'WP_Customize_Background_Position_Control' ); $this->register_control_type( 'WP_Customize_Cropped_Image_Control' ); $this->register_control_type( 'WP_Customize_Site_Icon_Control' ); $this->register_control_type( 'WP_Customize_Theme_Control' ); $this->register_control_type( 'WP_Customize_Code_Editor_Control' ); $this->register_control_type( 'WP_Customize_Date_Time_Control' ); /** * Fires once WordPress has loaded, allowing scripts and styles to be initialized. * * @since 3.4.0 * * @param WP_Customize_Manager $manager WP_Customize_Manager instance. */ do_action( 'customize_register', $this ); if ( $this->settings_previewed() ) { foreach ( $this->settings as $setting ) { $setting->preview(); } } if ( $this->is_preview() && ! is_admin() ) { $this->customize_preview_init(); } }Changelog
Introduced in 3.4.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.9.7 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.