wppaste
WordPress

WP_Customize_Widgets::call_widget_update( string $widget_id ): array|WP_Error

Since
3.9.0
Source
wp-includes/class-wp-customize-widgets.php:1577
Finds and invokes the widget update and control callbacks.

Description

Requires that $_POST be populated with the instance data.

Compatibility

WordPress
since 3.9.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.

Parameters

$widget_idstring
Widget ID.

Return value

array|WP_Error
Array containing the updated widget information.
A WP_Error object, otherwise.

Performance profile

How much work a call to WP_Customize_Widgets::call_widget_update() 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
40–158

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

Plugin surface
None

Nothing here hands control to plugin code.

Called by
1

1 place in core call this, so the cost is paid more often than your own code shows.

What it touches

  • serializeserialisationjson_decode()called directly

What one call costs · 76 distinct outcomes

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

WhenInstructionsCalls it makes
did_action() && !empty($value) && $sanitized_widget_setting === false40->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->stop_capturing_option_updates()
did_action() && empty($value)43–45->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), ->count_captured_options(), ->count_captured_options(), ->stop_capturing_option_updates()
!did_action() && !empty($value) && $sanitized_widget_setting === false45–46->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->stop_capturing_option_updates()
!did_action() && empty($value)48–51->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), ->count_captured_options(), ->count_captured_options(), ->stop_capturing_option_updates()
did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance === null49->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), ->stop_capturing_option_updates()
did_action() && empty($value) && $updated_option_name !== false51–53->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->stop_capturing_option_updates()
!did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance === null54–55->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), ->stop_capturing_option_updates()
!did_action() && empty($value) && $updated_option_name !== false56–59->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->stop_capturing_option_updates()
did_action() && empty($value) && !$wp_registered_widget_updates && $name === false && is_callable()63–64->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->count_captured_options(), ->stop_capturing_option_updates()
did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null67–70->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), ->count_captured_options(), ->count_captured_options(), ->stop_capturing_option_updates()
did_action() && empty($value)67–72->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), ->count_captured_options(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
!did_action() && empty($value) && !$wp_registered_widget_updates && $name === false && is_callable()68–70->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->count_captured_options(), ->stop_capturing_option_updates()
64 further outcomes, up to 158 instructions
did_action() && empty($value) && !$wp_registered_widget_updates && $name === false && is_callable() && $updated_option_name !== false71–72->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->stop_capturing_option_updates()
!did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null72–76->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), ->count_captured_options(), ->count_captured_options(), ->stop_capturing_option_updates()
!did_action() && empty($value)72–78->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), ->count_captured_options(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
did_action() && empty($value)73–78->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), ->count_captured_options(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), call_user_func_array(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && $updated_option_name !== false75–78->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->stop_capturing_option_updates()
!did_action() && empty($value) && !$wp_registered_widget_updates && $name === false && is_callable() && $updated_option_name !== false76–78->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->stop_capturing_option_updates()
!did_action() && empty($value)78–84->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), ->count_captured_options(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), call_user_func_array(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
did_action() && empty($value) && $updated_option_name === false79–84->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
!did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && $updated_option_name !== false80–84->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->stop_capturing_option_updates()
!did_action() && empty($value) && $updated_option_name === false84–90->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
did_action() && empty($value) && $updated_option_name === false85–90->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), call_user_func_array(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null86–88->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), wp_slash(), ->count_captured_options(), ->count_captured_options(), ->stop_capturing_option_updates()
did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && !$wp_registered_widget_updates && $name === false && is_callable()87–89->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->count_captured_options(), ->stop_capturing_option_updates()
did_action() && empty($value) && !$wp_registered_widget_updates && $name === false && is_callable()87–91->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
!did_action() && empty($value) && $updated_option_name === false90–96->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), call_user_func_array(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
!did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null91–94->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), wp_slash(), ->count_captured_options(), ->count_captured_options(), ->stop_capturing_option_updates()
did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null91–97->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), ->count_captured_options(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
!did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && !$wp_registered_widget_updates && $name === false && is_callable()92–95->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->count_captured_options(), ->stop_capturing_option_updates()
!did_action() && empty($value) && !$wp_registered_widget_updates && $name === false && is_callable()92–97->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
did_action() && empty($value) && !$wp_registered_widget_updates && $name === false && is_callable()93–97->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), call_user_func_array(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && $updated_option_name !== false94–96->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), wp_slash(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->stop_capturing_option_updates()
did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && !$wp_registered_widget_updates && $name === false && is_callable() && $updated_option_name !== false95–97->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->stop_capturing_option_updates()
!did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null96–103->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), ->count_captured_options(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null97–103->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), ->count_captured_options(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), call_user_func_array(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
!did_action() && empty($value) && !$wp_registered_widget_updates && $name === false && is_callable()98–103->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), call_user_func_array(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
!did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && $updated_option_name !== false99–102->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), wp_slash(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->stop_capturing_option_updates()
did_action() && empty($value) && !$wp_registered_widget_updates && $name === false && is_callable() && $updated_option_name === false99–103->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
!did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && !$wp_registered_widget_updates && $name === false && is_callable() && $updated_option_name !== false100–103->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->stop_capturing_option_updates()
!did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null102–109->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), ->count_captured_options(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), call_user_func_array(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && $updated_option_name === false103–109->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
!did_action() && empty($value) && !$wp_registered_widget_updates && $name === false && is_callable() && $updated_option_name === false104–109->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
did_action() && empty($value) && !$wp_registered_widget_updates && $name === false && is_callable() && $updated_option_name === false105–109->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), call_user_func_array(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && !$wp_registered_widget_updates && $name === false && is_callable()106–107->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), wp_slash(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->count_captured_options(), ->stop_capturing_option_updates()
!did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && $updated_option_name === false108–115->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && $updated_option_name === false109–115->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), call_user_func_array(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null110–115->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), wp_slash(), ->count_captured_options(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
!did_action() && empty($value) && !$wp_registered_widget_updates && $name === false && is_callable() && $updated_option_name === false110–115->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), call_user_func_array(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
!did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && !$wp_registered_widget_updates && $name === false && is_callable()111–113->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), wp_slash(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->count_captured_options(), ->stop_capturing_option_updates()
did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && !$wp_registered_widget_updates && $name === false && is_callable()111–116->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && !$wp_registered_widget_updates && $name === false && is_callable() && $updated_option_name !== false114–115->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), wp_slash(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->stop_capturing_option_updates()
!did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && $updated_option_name === false114–121->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), call_user_func_array(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
!did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null115–121->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), wp_slash(), ->count_captured_options(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null116–121->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), wp_slash(), ->count_captured_options(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), call_user_func_array(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
!did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && !$wp_registered_widget_updates && $name === false && is_callable()116–122->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && !$wp_registered_widget_updates && $name === false && is_callable()117–122->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), call_user_func_array(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
!did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && !$wp_registered_widget_updates && $name === false && is_callable() && $updated_option_name !== false119–121->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), wp_slash(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->stop_capturing_option_updates()
!did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null121–127->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), wp_slash(), ->count_captured_options(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), call_user_func_array(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && $updated_option_name === false122–127->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), wp_slash(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
!did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && !$wp_registered_widget_updates && $name === false && is_callable()122–128->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), call_user_func_array(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && !$wp_registered_widget_updates && $name === false && is_callable() && $updated_option_name === false123–128->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
!did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && $updated_option_name === false127–133->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), wp_slash(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && $updated_option_name === false128–133->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), wp_slash(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), call_user_func_array(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
!did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && !$wp_registered_widget_updates && $name === false && is_callable() && $updated_option_name === false128–134->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && !$wp_registered_widget_updates && $name === false && is_callable() && $updated_option_name === false129–134->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), call_user_func_array(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && !$wp_registered_widget_updates && $name === false && is_callable()130–134->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), wp_slash(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
!did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && $updated_option_name === false133–139->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), wp_slash(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), call_user_func_array(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
!did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && !$wp_registered_widget_updates && $name === false && is_callable() && $updated_option_name === false134–140->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), call_user_func_array(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
!did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && !$wp_registered_widget_updates && $name === false && is_callable()135–140->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), wp_slash(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && !$wp_registered_widget_updates && $name === false && is_callable()136–140->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), wp_slash(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), call_user_func_array(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
!did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && !$wp_registered_widget_updates && $name === false && is_callable()141–146->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), wp_slash(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), call_user_func_array(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && !$wp_registered_widget_updates && $name === false && is_callable() && $updated_option_name === false142–146->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), wp_slash(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
!did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && !$wp_registered_widget_updates && $name === false && is_callable() && $updated_option_name === false147–152->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), wp_slash(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && !$wp_registered_widget_updates && $name === false && is_callable() && $updated_option_name === false148–152->get_setting_id(), did_action(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), wp_slash(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), call_user_func_array(), ob_get_clean(), ->stop_capturing_option_updates(), compact()
!did_action() && !empty($value) && $sanitized_widget_setting !== false && $instance !== null && !$wp_registered_widget_updates && $name === false && is_callable() && $updated_option_name === false153–158->get_setting_id(), did_action(), ->settings(), ->start_capturing_option_updates(), ->parse_widget_id(), ->get_post_value(), json_decode(), ->sanitize_widget_instance(), wp_slash(), is_callable(), ob_start(), call_user_func_array(), ob_end_clean(), ->count_captured_options(), ->count_captured_options(), ->get_captured_options(), key(), ->get_captured_option(), ->sanitize_widget_js_instance(), ->set_post_value(), ob_start(), call_user_func_array(), ob_get_clean(), ->stop_capturing_option_updates(), compact()

Across PHP versions

PHPCompiledExecutedBranchesNotes
8.6-dev21240–15821
8.521240–15821
8.421240–15821
8.321240–15821
8.221240–15821
8.121240–158212 more instructions than PHP 7.4
7.421040–15621

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 · 13

Show all 13

Used by · 1

Source code

	public function call_widget_update( $widget_id ) {		global $wp_registered_widget_updates, $wp_registered_widget_controls; 		$setting_id = $this->get_setting_id( $widget_id ); 		/*		 * Make sure that other setting changes have previewed since this widget		 * may depend on them (e.g. Menus being present for Navigation Menu widget).		 */		if ( ! did_action( 'customize_preview_init' ) ) {			foreach ( $this->manager->settings() as $setting ) {				if ( $setting->id !== $setting_id ) {					$setting->preview();				}			}		} 		$this->start_capturing_option_updates();		$parsed_id   = $this->parse_widget_id( $widget_id );		$option_name = 'widget_' . $parsed_id['id_base']; 		/*		 * If a previously-sanitized instance is provided, populate the input vars		 * with its values so that the widget update callback will read this instance		 */		$added_input_vars = array();		if ( ! empty( $_POST['sanitized_widget_setting'] ) ) {			$sanitized_widget_setting = json_decode( $this->get_post_value( 'sanitized_widget_setting' ), true );			if ( false === $sanitized_widget_setting ) {				$this->stop_capturing_option_updates();				return new WP_Error( 'widget_setting_malformed' );			} 			$instance = $this->sanitize_widget_instance( $sanitized_widget_setting, $parsed_id['id_base'] );			if ( is_null( $instance ) ) {				$this->stop_capturing_option_updates();				return new WP_Error( 'widget_setting_unsanitized' );			} 			if ( ! is_null( $parsed_id['number'] ) ) {				$value                         = array();				$value[ $parsed_id['number'] ] = $instance;				$key                           = 'widget-' . $parsed_id['id_base'];				$_REQUEST[ $key ]              = wp_slash( $value );				$_POST[ $key ]                 = $_REQUEST[ $key ];				$added_input_vars[]            = $key;			} else {				foreach ( $instance as $key => $value ) {					$_REQUEST[ $key ]   = wp_slash( $value );					$_POST[ $key ]      = $_REQUEST[ $key ];					$added_input_vars[] = $key;				}			}		} 		// Invoke the widget update callback.		foreach ( (array) $wp_registered_widget_updates as $name => $control ) {			if ( $name === $parsed_id['id_base'] && is_callable( $control['callback'] ) ) {				ob_start();				call_user_func_array( $control['callback'], $control['params'] );				ob_end_clean();				break;			}		} 		// Clean up any input vars that were manually added.		foreach ( $added_input_vars as $key ) {			unset( $_POST[ $key ] );			unset( $_REQUEST[ $key ] );		} 		// Make sure the expected option was updated.		if ( 0 !== $this->count_captured_options() ) {			if ( $this->count_captured_options() > 1 ) {				$this->stop_capturing_option_updates();				return new WP_Error( 'widget_setting_too_many_options' );			} 			$updated_option_name = key( $this->get_captured_options() );			if ( $updated_option_name !== $option_name ) {

Changelog

Introduced in 3.9.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-widgets.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.