Skip to content

Commit 5595995

Browse files
committed
Widgets: Match variable types in rss feed link filter.
The `rss_widget_feed_link` filter added in [52031] documents the parameter as a string, but recommends removing by returning false. Change the recommendation and documentation to make this consistent and update Twenty Twenty One to use the new recommended return value. Maintains documentation as possibly returning `false` for backwards compatibility. Props sabernhardt, Mista-Flo. Fixes #57594. git-svn-id: https://develop.svn.wordpress.org/trunk@55409 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 6b04c0b commit 5595995

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/wp-content/themes/twentytwentyone/functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ function twenty_twenty_one_setup() {
340340
add_theme_support( 'custom-units' );
341341

342342
// Remove feed icon link from legacy RSS widget.
343-
add_filter( 'rss_widget_feed_link', '__return_false' );
343+
add_filter( 'rss_widget_feed_link', '__return_empty_string' );
344344
}
345345
}
346346
add_action( 'after_setup_theme', 'twenty_twenty_one_setup' );

src/wp-includes/widgets/class-wp-widget-rss.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ public function widget( $args, $instance ) {
101101
/**
102102
* Filters the classic RSS widget's feed icon link.
103103
*
104-
* Themes can remove the icon link by using `add_filter( 'rss_widget_feed_link', '__return_false' );`.
104+
* Themes can remove the icon link by using `add_filter( 'rss_widget_feed_link', '__return_empty_string' );`.
105105
*
106106
* @since 5.9.0
107107
*
108-
* @param string $feed_link HTML for link to RSS feed.
109-
* @param array $instance Array of settings for the current widget.
108+
* @param string|false $feed_link HTML for link to RSS feed.
109+
* @param array $instance Array of settings for the current widget.
110110
*/
111111
$feed_link = apply_filters( 'rss_widget_feed_link', $feed_link, $instance );
112112

0 commit comments

Comments
 (0)