wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.



_register_widget_update_callback › WordPress Function

Od2.8.0
Przestarzałyn/a
_register_widget_update_callback ( $id_base, $update_callback, $options = array(), $params )
Parametry: (4)
  • (string) $id_base The base ID of a widget created by extending WP_Widget.
    Wymagane: Tak
  • (callable) $update_callback Update callback method for the widget.
    Wymagane: Tak
  • (array) $options Optional. Widget control options. See wp_register_widget_control(). Default empty array.
    Wymagane: Nie
    Domyślny: array()
  • (mixed) $params Optional additional parameters to pass to the callback function when it's called.
    Wymagane: Tak
Zdefiniowane na:
Codex:
Dziennik zmian:
  • 5.3.0

Registers the update callback for a widget.



Źródło

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