Make WordPress Core

Changeset 55409


Ignore:
Timestamp:
02/22/2023 10:00:08 PM (17 months ago)
Author:
joedolson
Message:

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.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentytwentyone/functions.php

    r52929 r55409  
    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}
  • trunk/src/wp-includes/widgets/class-wp-widget-rss.php

    r52031 r55409  
    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 );
Note: See TracChangeset for help on using the changeset viewer.