WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 2 years ago

#20788 new enhancement

Add widget instance argument to widget_links_args filter

Reported by: ragulka Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.3.2
Component: Widgets Keywords: dev-feedback has-patch
Focuses: Cc:

Description

Using the widget_links_args filter (used in the default Links Widget class) as it is right now is a bit useless because one does not have access to the widget instance that applies the filter.

Widget instance may contain custom variables set by custom fields that may have been added to the widget form by plugins or themes using other filters.

Being able to access widget instance from within the filter function gives developers lots of possibilities to customize the widget.

My suggestion is simple: add $instance argument to the widget_links_args filter, like this (wp-includes/default-widget.php line 113):

wp_list_bookmarks(apply_filters('widget_links_args', array(
	'title_before' => $before_title, 'title_after' => $after_title,
	'category_before' => $before_widget, 'category_after' => $after_widget,
	'show_images' => $show_images, 'show_description' => $show_description,
	'show_name' => $show_name, 'show_rating' => $show_rating,
	'category' => $category, 'class' => 'linkcat widget'
), $instance ));

Attachments (1)

20788.patch (965 bytes) - added by SergeyBiryukov 3 years ago.

Download all attachments as: .zip

Change History (3)

@SergeyBiryukov3 years ago

comment:1 @SergeyBiryukov3 years ago

  • Keywords has-patch added
Note: See TracTickets for help on using tickets.