WordPress Version: 6.5
/**
* Registers the update callback for a widget.
*
* @since 2.8.0
* @since 5.3.0 Formalized the existing and already documented `...$params` parameter
* by adding it to the function signature.
*
* @global array $wp_registered_widget_updates The registered widget updates.
*
* @param string $id_base The base ID of a widget created by extending WP_Widget.
* @param callable $update_callback Update callback method for the widget.
* @param array $options Optional. Widget control options. See wp_register_widget_control().
* Default empty array.
* @param mixed ...$params Optional additional parameters to pass to the callback function when it's called.
*/
function _register_widget_update_callback($id_base, $update_callback, $options = array(), ...$params)
{
global $wp_registered_widget_updates;
if (isset($wp_registered_widget_updates[$id_base])) {
if (empty($update_callback)) {
unset($wp_registered_widget_updates[$id_base]);
}
return;
}
$widget = array('callback' => $update_callback, 'params' => $params);
$widget = array_merge($widget, $options);
$wp_registered_widget_updates[$id_base] = $widget;
}