WordPress.org

Make WordPress Core

Ticket #47678: 47678-wp_register_sidebar_widget.patch

File 47678-wp_register_sidebar_widget.patch, 1.3 KB (added by jrf, 8 months ago)

Simplify & modernize wp_register_sidebar_widget()

  • src/wp-includes/widgets.php

    From fa9e32e461c9afeae28e939a9edc9e4811a1f029 Mon Sep 17 00:00:00 2001
    From: jrfnl <jrfnl@users.noreply.github.com>
    Date: Thu, 11 Jul 2019 12:29:01 +0200
    Subject: [PATCH] Simplify & modernize wp_register_sidebar_widget()
    
    ---
     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 28c79d1764..8961d4ec3c 100644
    a b function is_registered_sidebar( $sidebar_id ) { 
    339339 * }
    340340 * @param mixed      ...$params       Optional additional parameters to pass to the callback function when it's called.
    341341 */
    342 function wp_register_sidebar_widget( $id, $name, $output_callback, $options = array() ) {
     342function wp_register_sidebar_widget( $id, $name, $output_callback, $options = array(), ...$params ) {
    343343        global $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_widget_updates, $_wp_deprecated_widgets_callbacks;
    344344
    345345        $id = strtolower( $id );
    function wp_register_sidebar_widget( $id, $name, $output_callback, $options = ar 
    362362                'name'     => $name,
    363363                'id'       => $id,
    364364                'callback' => $output_callback,
    365                 'params'   => array_slice( func_get_args(), 4 ),
     365                'params'   => $params,
    366366        );
    367367        $widget   = array_merge( $widget, $options );
    368368