WordPress.org

Make WordPress Core

Ticket #47678: 47678-_register_widget_update_callback.patch

File 47678-_register_widget_update_callback.patch, 1.4 KB (added by jrf, 12 months ago)

Simplify & modernize _register_widget_update_callback()

  • src/wp-includes/widgets.php

    From 1b5be5cd060f146a9def0c525190a1d79c683c6c Mon Sep 17 00:00:00 2001
    From: jrfnl <jrfnl@users.noreply.github.com>
    Date: Thu, 11 Jul 2019 12:29:36 +0200
    Subject: [PATCH] Simplify & modernize _register_widget_update_callback()
    
    ---
     src/wp-includes/widgets.php | 4 ++--
     1 file changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/src/wp-includes/widgets.php b/src/wp-includes/widgets.php
    index e3bb63b582..5a3937fbf5 100644
    a b function wp_register_widget_control( $id, $name, $control_callback, $options = a 
    543543 *                                  Default empty array.
    544544 * @param mixed    ...$params       Optional additional parameters to pass to the callback function when it's called.
    545545 */
    546 function _register_widget_update_callback( $id_base, $update_callback, $options = array() ) {
     546function _register_widget_update_callback( $id_base, $update_callback, $options = array(), ...$params ) {
    547547        global $wp_registered_widget_updates;
    548548
    549549        if ( isset( $wp_registered_widget_updates[ $id_base ] ) ) {
    function _register_widget_update_callback( $id_base, $update_callback, $options 
    555555
    556556        $widget = array(
    557557                'callback' => $update_callback,
    558                 'params'   => array_slice( func_get_args(), 3 ),
     558                'params'   => $params,
    559559        );
    560560
    561561        $widget                                   = array_merge( $widget, $options );