WordPress.org

Make WordPress Core

Ticket #47678: 47678-wp_register_widget_control.patch

File 47678-wp_register_widget_control.patch, 1.4 KB (added by jrf, 16 months ago)

Simplify & modernize wp_register_widget_control()

  • src/wp-includes/widgets.php

    From 46728105d526c373f044b493b589bed444123d45 Mon Sep 17 00:00:00 2001
    From: jrfnl <jrfnl@users.noreply.github.com>
    Date: Thu, 11 Jul 2019 12:29:19 +0200
    Subject: [PATCH] Simplify & modernize wp_register_widget_control()
    
    ---
     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 8961d4ec3c..e3bb63b582 100644
    a b function wp_unregister_sidebar_widget( $id ) { 
    479479 * }
    480480 * @param mixed      ...$params        Optional additional parameters to pass to the callback function when it's called.
    481481 */
    482 function wp_register_widget_control( $id, $name, $control_callback, $options = array() ) {
     482function wp_register_widget_control( $id, $name, $control_callback, $options = array(), ...$params ) {
    483483        global $wp_registered_widget_controls, $wp_registered_widget_updates, $wp_registered_widgets, $_wp_deprecated_widgets_callbacks;
    484484
    485485        $id      = strtolower( $id );
    function wp_register_widget_control( $id, $name, $control_callback, $options = a 
    512512                'name'     => $name,
    513513                'id'       => $id,
    514514                'callback' => $control_callback,
    515                 'params'   => array_slice( func_get_args(), 4 ),
     515                'params'   => $params,
    516516        );
    517517        $widget = array_merge( $widget, $options );
    518518