From ab9bbfa9cec97e22bfe1be0fd729582d28b65250 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Wed, 9 Sep 2015 04:41:21 +0000 Subject: [PATCH] `WP_Widget_Links`: pass widget instance to `widget_links_args` filter Props SergeyBiryukov, MikeHansenMe, DrewAPicture. Fixes #20788. git-svn-id: https://develop.svn.wordpress.org/trunk@33971 602fd350-edb4-49c9-b593-d223f7449a82 --- .../widgets/class-wp-widget-links.php | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/wp-includes/widgets/class-wp-widget-links.php b/src/wp-includes/widgets/class-wp-widget-links.php index 804153c718..e61e72c7bb 100644 --- a/src/wp-includes/widgets/class-wp-widget-links.php +++ b/src/wp-includes/widgets/class-wp-widget-links.php @@ -29,24 +29,34 @@ class WP_Widget_Links extends WP_Widget { $before_widget = preg_replace( '/id="[^"]*"/', 'id="%id"', $args['before_widget'] ); + $widget_links_args = array( + 'title_before' => $args['before_title'], + 'title_after' => $args['after_title'], + 'category_before' => $before_widget, + 'category_after' => $args['after_widget'], + 'show_images' => $show_images, + 'show_description' => $show_description, + 'show_name' => $show_name, + 'show_rating' => $show_rating, + 'category' => $category, + 'class' => 'linkcat widget', + 'orderby' => $orderby, + 'order' => $order, + 'limit' => $limit, + ); + /** * Filter the arguments for the Links widget. * * @since 2.6.0 + * @since 4.4.0 The `$instance` parameter was added. * * @see wp_list_bookmarks() * - * @param array $args An array of arguments to retrieve the links list. + * @param array $args An array of arguments to retrieve the links list. + * @param array $instance The settings for the particular instance of the widget. */ - wp_list_bookmarks( apply_filters( 'widget_links_args', array( - 'title_before' => $args['before_title'], 'title_after' => $args['after_title'], - 'category_before' => $before_widget, 'category_after' => $args['after_widget'], - 'show_images' => $show_images, 'show_description' => $show_description, - 'show_name' => $show_name, 'show_rating' => $show_rating, - 'category' => $category, 'class' => 'linkcat widget', - 'orderby' => $orderby, 'order' => $order, - 'limit' => $limit, - ) ) ); + wp_list_bookmarks( apply_filters( 'widget_links_args', $widget_links_args, $instance ) ); } /**