wpseek.com
A WordPress-centric search engine for devs and theme authors



_register_widget_update_callback › WordPress Function

Since2.8.0
Deprecatedn/a
_register_widget_update_callback ( $id_base, $update_callback, $options = array(), $params )
Parameters: (4)
  • (string) $id_base The base ID of a widget created by extending WP_Widget.
    Required: Yes
  • (callable) $update_callback Update callback method for the widget.
    Required: Yes
  • (array) $options Optional. Widget control options. See wp_register_widget_control(). Default empty array.
    Required: No
    Default: array()
  • (mixed) $params Optional additional parameters to pass to the callback function when it's called.
    Required: Yes
Defined at:
Codex:
Change Log:
  • 5.3.0

Registers the update callback for a widget.



Source

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;
}