#20788 closed enhancement (fixed)
Add widget instance argument to widget_links_args filter
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.4 | Priority: | normal |
Severity: | normal | Version: | 3.3 |
Component: | Widgets | Keywords: | dev-feedback has-patch commit |
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 (3)
Change History (11)
#4
@
9 years ago
- Keywords commit added
- Milestone changed from Awaiting Review to 4.4
20788.diff refreshes the patch and simplifies the actual filter call by splitting out the args array to a separate variable. Adds the new parameter + docs
Moving for commit consideration.
Related: #21307