WP_Customize_Manager::register_controls()
- Since
- 3.4.0
- Source
wp-includes/class-wp-customize-manager.php:5074
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::register_controls() 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
- Scaling
- Scales with input
- Instructions
- 836–913
- Plugin surface
- None
- Called by
- 0
Reads stored settings via get_option(), cached per request but not free on a cold cache.
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 988.
Nothing here hands control to plugin code.
Nothing in core calls this; the cost is only what you spend yourself.
What it touches
- optionoption read or write
get_option()called directly - hookthird-party callbacks
apply_filters()one call below WP_Customize_Manager::register_controls() - cacheobject cache
wp_cache_get()one call below WP_Customize_Manager::register_controls() - serializeserialisation
maybe_unserialize()one call below WP_Customize_Manager::register_controls()
Further down the call graph this can also reach transient and query. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.
What one call costs · 8 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost WP_Customize_Manager::register_controls() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
is_multisite() | 836–842 | ->theme(), ->display(), __(), __(), title(), ->add_panel(), __(), title(), ->add_section(), is_multisite(), ->add_setting(), __(), title(), get_option(), default(), __(), label(), get_option(), default(), __(), label(), current_theme_supports(), ->add_setting(), __(), __(), sprintf(), label(), ->add_control(), ->add_setting(), get_theme_support(), __(), __(), __(), __(), __(), __(), __(), __(), select(), label(), __(), title(), get_theme_support(), __(), header_textcolor(), __(), label(), ->add_control(), get_theme_support(), default(), __(), label(), ->add_control(), current_theme_supports(), __(), title(), get_theme_support(), get_template_directory_uri(), get_stylesheet_directory_uri(), sprintf(), default(), ->add_setting(), ->add_setting(), current_theme_supports(), __(), theme_supports(), ->add_control(), __(), theme_supports(), ->add_control(), ->add_control(), ->add_partial(), __(), title(), get_theme_support(), custom-background(), ->add_control(), ->add_setting(), get_theme_support(), _x(), _x(), __(), __(), _x(), _x(), default(), get_theme_support(), get_theme_support(), __(), label(), ->add_control(), get_theme_support(), __(), _x(), __(), __(), auto(), get_theme_support(), __(), label(), get_theme_support(), __(), label(), get_theme_support(), __(), __(), get_option(), default(), __(), __(), __(), posts(), ->add_setting(), __(), label(), ->add_setting(), __(), label(), __(), __(), esc_url(), __(), __(), sprintf(), __(), __(), __(), __(), wp_get_current_user(), __(), __(), title(), get_stylesheet(), ->add_section(), ->add_setting(), __(), default(), label() |
is_multisite() | 848–854 | ->theme(), ->display(), __(), __(), title(), ->add_panel(), __(), title(), ->add_section(), is_multisite(), ->add_setting(), __(), title(), get_option(), default(), __(), label(), get_option(), default(), __(), label(), current_theme_supports(), ->add_setting(), __(), __(), sprintf(), label(), ->add_control(), ->add_setting(), get_theme_support(), __(), __(), __(), __(), __(), __(), __(), __(), select(), label(), __(), title(), get_theme_support(), __(), header_textcolor(), __(), label(), ->add_control(), get_theme_support(), default(), __(), label(), ->add_control(), current_theme_supports(), __(), title(), get_theme_support(), get_template_directory_uri(), get_stylesheet_directory_uri(), sprintf(), default(), ->add_setting(), ->add_setting(), current_theme_supports(), ->get_setting(), ->get_setting(), __(), theme_supports(), ->add_control(), __(), theme_supports(), ->add_control(), ->add_control(), ->add_partial(), __(), title(), get_theme_support(), custom-background(), ->add_control(), ->add_setting(), get_theme_support(), _x(), _x(), __(), __(), _x(), _x(), default(), get_theme_support(), get_theme_support(), __(), label(), ->add_control(), get_theme_support(), __(), _x(), __(), __(), auto(), get_theme_support(), __(), label(), get_theme_support(), __(), label(), get_theme_support(), __(), __(), get_option(), default(), __(), __(), __(), posts(), ->add_setting(), __(), label(), ->add_setting(), __(), label(), __(), __(), esc_url(), __(), __(), sprintf(), __(), __(), __(), __(), wp_get_current_user(), __(), __(), title(), get_stylesheet(), ->add_section(), ->add_setting(), __(), default(), label() |
is_multisite() | 859–865 | ->theme(), ->display(), __(), __(), title(), ->add_panel(), __(), title(), ->add_section(), is_multisite(), ->add_setting(), __(), title(), get_option(), default(), __(), label(), get_option(), default(), __(), label(), current_theme_supports(), ->add_setting(), __(), __(), sprintf(), label(), ->add_control(), ->add_setting(), get_theme_support(), __(), __(), __(), __(), __(), __(), __(), __(), select(), label(), __(), title(), get_theme_support(), __(), header_textcolor(), __(), label(), ->add_control(), get_theme_support(), default(), __(), label(), ->add_control(), current_theme_supports(), __(), title(), get_theme_support(), get_template_directory_uri(), get_stylesheet_directory_uri(), sprintf(), default(), ->add_setting(), ->add_setting(), current_theme_supports(), __(), theme_supports(), ->add_control(), __(), theme_supports(), ->add_control(), ->add_control(), ->add_partial(), __(), title(), get_theme_support(), custom-background(), ->add_control(), ->add_setting(), get_theme_support(), _x(), _x(), __(), __(), _x(), _x(), default(), get_theme_support(), get_theme_support(), __(), label(), ->add_control(), get_theme_support(), __(), _x(), __(), __(), auto(), get_theme_support(), __(), label(), get_theme_support(), __(), label(), get_theme_support(), __(), __(), get_option(), default(), __(), __(), __(), posts(), ->add_setting(), __(), label(), ->add_setting(), __(), label(), __(), __(), esc_url(), __(), __(), sprintf(), __(), __(), __(), __(), wp_get_current_user(), __(), get_edit_profile_url(), esc_url(), __(), sprintf(), __(), __(), title(), get_stylesheet(), ->add_section(), ->add_setting(), __(), default(), label() |
is_multisite() | 869–878 | ->theme(), ->display(), __(), __(), title(), ->add_panel(), __(), title(), ->add_section(), is_multisite(), ->add_setting(), __(), title(), get_option(), default(), __(), label(), get_option(), default(), __(), label(), current_theme_supports(), ->add_setting(), __(), __(), sprintf(), label(), ->add_control(), ->add_setting(), get_theme_support(), __(), __(), __(), __(), __(), __(), __(), __(), select(), label(), __(), title(), get_theme_support(), __(), header_textcolor(), __(), label(), ->add_control(), get_theme_support(), default(), __(), label(), ->add_control(), current_theme_supports(), __(), __(), get_theme_support(), absint(), get_theme_support(), absint(), __(), sprintf(), title(), get_theme_support(), get_template_directory_uri(), get_stylesheet_directory_uri(), sprintf(), default(), ->add_setting(), ->add_setting(), current_theme_supports(), __(), theme_supports(), ->add_control(), __(), theme_supports(), ->add_control(), ->add_control(), ->add_partial(), __(), title(), get_theme_support(), custom-background(), ->add_control(), ->add_setting(), get_theme_support(), _x(), _x(), __(), __(), _x(), _x(), default(), get_theme_support(), get_theme_support(), __(), label(), ->add_control(), get_theme_support(), __(), _x(), __(), __(), auto(), get_theme_support(), __(), label(), get_theme_support(), __(), label(), get_theme_support(), __(), __(), get_option(), default(), __(), __(), __(), posts(), ->add_setting(), __(), label(), ->add_setting(), __(), label(), __(), __(), esc_url(), __(), __(), sprintf(), __(), __(), __(), __(), wp_get_current_user(), __(), __(), title(), get_stylesheet(), ->add_section(), ->add_setting(), __(), default(), label() |
is_multisite() | 871–877 | ->theme(), ->display(), __(), __(), title(), ->add_panel(), __(), title(), ->add_section(), is_multisite(), ->add_setting(), __(), title(), get_option(), default(), __(), label(), get_option(), default(), __(), label(), current_theme_supports(), ->add_setting(), __(), __(), sprintf(), label(), ->add_control(), ->add_setting(), get_theme_support(), __(), __(), __(), __(), __(), __(), __(), __(), select(), label(), __(), title(), get_theme_support(), __(), header_textcolor(), __(), label(), ->add_control(), get_theme_support(), default(), __(), label(), ->add_control(), current_theme_supports(), __(), title(), get_theme_support(), get_template_directory_uri(), get_stylesheet_directory_uri(), sprintf(), default(), ->add_setting(), ->add_setting(), current_theme_supports(), ->get_setting(), ->get_setting(), __(), theme_supports(), ->add_control(), __(), theme_supports(), ->add_control(), ->add_control(), ->add_partial(), __(), title(), get_theme_support(), custom-background(), ->add_control(), ->add_setting(), get_theme_support(), _x(), _x(), __(), __(), _x(), _x(), default(), get_theme_support(), get_theme_support(), __(), label(), ->add_control(), get_theme_support(), __(), _x(), __(), __(), auto(), get_theme_support(), __(), label(), get_theme_support(), __(), label(), get_theme_support(), __(), __(), get_option(), default(), __(), __(), __(), posts(), ->add_setting(), __(), label(), ->add_setting(), __(), label(), __(), __(), esc_url(), __(), __(), sprintf(), __(), __(), __(), __(), wp_get_current_user(), __(), get_edit_profile_url(), esc_url(), __(), sprintf(), __(), __(), title(), get_stylesheet(), ->add_section(), ->add_setting(), __(), default(), label() |
is_multisite() && current_theme_supports() | 881–890 | ->theme(), ->display(), __(), __(), title(), ->add_panel(), __(), title(), ->add_section(), is_multisite(), ->add_setting(), __(), title(), get_option(), default(), __(), label(), get_option(), default(), __(), label(), current_theme_supports(), ->add_setting(), __(), __(), sprintf(), label(), ->add_control(), ->add_setting(), get_theme_support(), __(), __(), __(), __(), __(), __(), __(), __(), select(), label(), __(), title(), get_theme_support(), __(), header_textcolor(), __(), label(), ->add_control(), get_theme_support(), default(), __(), label(), ->add_control(), current_theme_supports(), __(), __(), get_theme_support(), absint(), get_theme_support(), absint(), __(), sprintf(), title(), get_theme_support(), get_template_directory_uri(), get_stylesheet_directory_uri(), sprintf(), default(), ->add_setting(), ->add_setting(), current_theme_supports(), ->get_setting(), ->get_setting(), __(), theme_supports(), ->add_control(), __(), theme_supports(), ->add_control(), ->add_control(), ->add_partial(), __(), title(), get_theme_support(), custom-background(), ->add_control(), ->add_setting(), get_theme_support(), _x(), _x(), __(), __(), _x(), _x(), default(), get_theme_support(), get_theme_support(), __(), label(), ->add_control(), get_theme_support(), __(), _x(), __(), __(), auto(), get_theme_support(), __(), label(), get_theme_support(), __(), label(), get_theme_support(), __(), __(), get_option(), default(), __(), __(), __(), posts(), ->add_setting(), __(), label(), ->add_setting(), __(), label(), __(), __(), esc_url(), __(), __(), sprintf(), __(), __(), __(), __(), wp_get_current_user(), __(), __(), title(), get_stylesheet(), ->add_section(), ->add_setting(), __(), default(), label() |
is_multisite() | 892–901 | ->theme(), ->display(), __(), __(), title(), ->add_panel(), __(), title(), ->add_section(), is_multisite(), ->add_setting(), __(), title(), get_option(), default(), __(), label(), get_option(), default(), __(), label(), current_theme_supports(), ->add_setting(), __(), __(), sprintf(), label(), ->add_control(), ->add_setting(), get_theme_support(), __(), __(), __(), __(), __(), __(), __(), __(), select(), label(), __(), title(), get_theme_support(), __(), header_textcolor(), __(), label(), ->add_control(), get_theme_support(), default(), __(), label(), ->add_control(), current_theme_supports(), __(), __(), get_theme_support(), absint(), get_theme_support(), absint(), __(), sprintf(), title(), get_theme_support(), get_template_directory_uri(), get_stylesheet_directory_uri(), sprintf(), default(), ->add_setting(), ->add_setting(), current_theme_supports(), __(), theme_supports(), ->add_control(), __(), theme_supports(), ->add_control(), ->add_control(), ->add_partial(), __(), title(), get_theme_support(), custom-background(), ->add_control(), ->add_setting(), get_theme_support(), _x(), _x(), __(), __(), _x(), _x(), default(), get_theme_support(), get_theme_support(), __(), label(), ->add_control(), get_theme_support(), __(), _x(), __(), __(), auto(), get_theme_support(), __(), label(), get_theme_support(), __(), label(), get_theme_support(), __(), __(), get_option(), default(), __(), __(), __(), posts(), ->add_setting(), __(), label(), ->add_setting(), __(), label(), __(), __(), esc_url(), __(), __(), sprintf(), __(), __(), __(), __(), wp_get_current_user(), __(), get_edit_profile_url(), esc_url(), __(), sprintf(), __(), __(), title(), get_stylesheet(), ->add_section(), ->add_setting(), __(), default(), label() |
is_multisite() && current_theme_supports() | 904–913 | ->theme(), ->display(), __(), __(), title(), ->add_panel(), __(), title(), ->add_section(), is_multisite(), ->add_setting(), __(), title(), get_option(), default(), __(), label(), get_option(), default(), __(), label(), current_theme_supports(), ->add_setting(), __(), __(), sprintf(), label(), ->add_control(), ->add_setting(), get_theme_support(), __(), __(), __(), __(), __(), __(), __(), __(), select(), label(), __(), title(), get_theme_support(), __(), header_textcolor(), __(), label(), ->add_control(), get_theme_support(), default(), __(), label(), ->add_control(), current_theme_supports(), __(), __(), get_theme_support(), absint(), get_theme_support(), absint(), __(), sprintf(), title(), get_theme_support(), get_template_directory_uri(), get_stylesheet_directory_uri(), sprintf(), default(), ->add_setting(), ->add_setting(), current_theme_supports(), ->get_setting(), ->get_setting(), __(), theme_supports(), ->add_control(), __(), theme_supports(), ->add_control(), ->add_control(), ->add_partial(), __(), title(), get_theme_support(), custom-background(), ->add_control(), ->add_setting(), get_theme_support(), _x(), _x(), __(), __(), _x(), _x(), default(), get_theme_support(), get_theme_support(), __(), label(), ->add_control(), get_theme_support(), __(), _x(), __(), __(), auto(), get_theme_support(), __(), label(), get_theme_support(), __(), label(), get_theme_support(), __(), __(), get_option(), default(), __(), __(), __(), posts(), ->add_setting(), __(), label(), ->add_setting(), __(), label(), __(), __(), esc_url(), __(), __(), sprintf(), __(), __(), __(), __(), wp_get_current_user(), __(), get_edit_profile_url(), esc_url(), __(), sprintf(), __(), __(), title(), get_stylesheet(), ->add_section(), ->add_setting(), __(), default(), label() |
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
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 988 | 836–913 | 15 | |
| 8.5 | 988 | 836–913 | 15 | |
| 8.4 | 988 | 836–913 | 15 | 4 fewer instructions than PHP 8.3 |
| 8.3 | 992 | 837–915 | 15 | |
| 8.2 | 992 | 837–915 | 15 | |
| 8.1 | 992 | 837–915 | 15 | |
| 7.4 | 992 | 837–915 | 15 |
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 · 33
- __()Retrieves the translation of $text.
- is_multisite()Determines whether Multisite is enabled.
- get_option()Retrieves an option value based on an option name.
- current_theme_supports()Checks a theme's support for a given feature.
- get_theme_support()Gets the theme support arguments passed when registering that support.
- absint()Converts a value to non-negative integer.
- get_template_directory_uri()Retrieves template directory URI for the active theme.
- get_stylesheet_directory_uri()Retrieves stylesheet directory URI for the active theme.
- _x()Retrieves translated string with gettext context.
- esc_url()Checks and cleans a URL.
- wp_get_current_user()Retrieves the current user object.
- get_edit_profile_url()Retrieves the URL to the user's profile editor.
Show all 33
- get_stylesheet()Retrieves name of the current stylesheet.
- WP_Customize_Manager::add_panel()Adds a customize panel.
- WP_Customize_Themes_Panel::__construct()
- WP_Customize_Manager::theme()Gets the theme being customized.
- WP_Customize_Manager::add_section()Adds a customize section.
- WP_Customize_Themes_Section::__construct()
- WP_Customize_Manager::add_setting()Adds a customize setting.
- WP_Customize_Filter_Setting::__construct()
- WP_Customize_Manager::add_control()Adds a customize control.
- WP_Customize_Site_Icon_Control::__construct()Constructor.
- WP_Customize_Cropped_Image_Control::__construct()
- WP_Customize_Color_Control::__construct()Constructor.
- WP_Customize_Header_Image_Setting::__construct()
- WP_Customize_Manager::get_setting()Retrieves a customize setting.
- WP_Customize_Media_Control::__construct()Constructor.
- WP_Customize_Header_Image_Control::__construct()Constructor.
- WP_Customize_Background_Image_Setting::__construct()
- WP_Customize_Background_Image_Control::__construct()Constructor.
- WP_Customize_Background_Position_Control::__construct()
- WP_Customize_Custom_CSS_Setting::__construct()WP_Customize_Custom_CSS_Setting constructor.
- WP_Customize_Code_Editor_Control::__construct()
Source code
public function register_controls() { /* Themes (controls are loaded via ajax) */ $this->add_panel( new WP_Customize_Themes_Panel( $this, 'themes', array( 'title' => $this->theme()->display( 'Name' ), 'description' => ( '<p>' . __( 'Looking for a theme? You can search or browse the WordPress.org theme directory, install and preview themes, then activate them right here.' ) . '</p>' . '<p>' . __( 'While previewing a new theme, you can continue to tailor things like widgets and menus, and explore theme-specific options.' ) . '</p>' ), 'capability' => 'switch_themes', 'priority' => 0, ) ) ); $this->add_section( new WP_Customize_Themes_Section( $this, 'installed_themes', array( 'title' => __( 'Installed themes' ), 'action' => 'installed', 'capability' => 'switch_themes', 'panel' => 'themes', 'priority' => 0, ) ) ); if ( ! is_multisite() ) { $this->add_section( new WP_Customize_Themes_Section( $this, 'wporg_themes', array( 'title' => __( 'WordPress.org themes' ), 'action' => 'wporg', 'filter_type' => 'remote', 'capability' => 'install_themes', 'panel' => 'themes', 'priority' => 5, ) ) ); } // Themes Setting (unused - the theme is considerably more fundamental to the Customizer experience). $this->add_setting( new WP_Customize_Filter_Setting( $this, 'active_theme', array( 'capability' => 'switch_themes', ) ) ); /* Site Identity */ $this->add_section( 'title_tagline', array( 'title' => __( 'Site Identity' ), 'priority' => 20, ) ); $this->add_setting( 'blogname', array( 'default' => get_option( 'blogname' ), 'type' => 'option', 'capability' => 'manage_options', ) );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 7.1.0 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.