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
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
- Scaling
- Scales with input
- Instructions
- 40–158
- Plugin surface
- None
- Called by
- 1
Touches nothing outside its own arguments.
The body loops, so the work grows with what you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 212.
Nothing here hands control to plugin code.
1 place in core call this, so the cost is paid more often than your own code shows.
What it touches
- serializeserialisation
json_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.
| When | Instructions | Calls it makes |
|---|---|---|
did_action() && !empty($value) && $sanitized_widget_setting === false | 40 | ->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 === false | 45–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 === null | 49 | ->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 !== false | 51–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 === null | 54–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 !== false | 56–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 !== null | 67–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 !== false | 71–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 !== null | 72–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 !== false | 75–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 !== false | 76–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 === false | 79–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 !== false | 80–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 === false | 84–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 === false | 85–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 !== null | 86–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 === false | 90–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 !== null | 91–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 !== null | 91–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 !== false | 94–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 !== false | 95–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 !== null | 96–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 !== null | 97–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 !== false | 99–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 === false | 99–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 !== false | 100–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 !== null | 102–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 === false | 103–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 === false | 104–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 === false | 105–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 === false | 108–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 === false | 109–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 !== null | 110–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 === false | 110–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 !== false | 114–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 === false | 114–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 !== null | 115–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 !== null | 116–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 !== false | 119–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 !== null | 121–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 === false | 122–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 === false | 123–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 === false | 127–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 === false | 128–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 === false | 128–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 === false | 129–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 === false | 133–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 === false | 134–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 === false | 142–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 === false | 147–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 === false | 148–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 === false | 153–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
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 212 | 40–158 | 21 | |
| 8.5 | 212 | 40–158 | 21 | |
| 8.4 | 212 | 40–158 | 21 | |
| 8.3 | 212 | 40–158 | 21 | |
| 8.2 | 212 | 40–158 | 21 | |
| 8.1 | 212 | 40–158 | 21 | 2 more instructions than PHP 7.4 |
| 7.4 | 210 | 40–156 | 21 |
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
- did_action()Retrieves the number of times an action has been fired during the current request.
- wp_slash()Adds slashes to a string or recursively adds slashes to strings within an array.
- WP_Customize_Widgets::get_setting_id()Converts a widget_id into its corresponding Customizer setting ID (option name).
- WP_Customize_Widgets::start_capturing_option_updates()Begins keeping track of changes to widget options, caching new values.
- WP_Customize_Widgets::parse_widget_id()Converts a widget ID into its id_base and number components.
- WP_Customize_Widgets::get_post_value()Retrieves an unslashed post value or return a default.
- WP_Customize_Widgets::stop_capturing_option_updates()Undoes any changes to the options since options capture began.
- WP_Error::__construct()Initializes the error.
- WP_Customize_Widgets::sanitize_widget_instance()Sanitizes a widget instance.
- WP_Customize_Widgets::count_captured_options()Retrieves the number of captured widget option updates.
- WP_Customize_Widgets::get_captured_options()Retrieves captured widget option updates.
- WP_Customize_Widgets::get_captured_option()Retrieves the option that was captured from being saved.
Show all 13
- WP_Customize_Widgets::sanitize_widget_js_instance()Converts a widget instance into JSON-representable format.
Used by · 1
- WP_Customize_Widgets::wp_ajax_update_widget()Updates widget settings asynchronously.
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.
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.