Make WordPress Core

Ticket #32065: 32065.2.diff

File 32065.2.diff, 1.3 KB (added by donmhico, 6 years ago)
  • src/wp-includes/widgets/class-wp-widget-rss.php

    diff --git src/wp-includes/widgets/class-wp-widget-rss.php src/wp-includes/widgets/class-wp-widget-rss.php
    index 570e7bba43..f6e67ccb10 100644
    class WP_Widget_RSS extends WP_Widget { 
    3737         * Outputs the content for the current RSS widget instance.
    3838         *
    3939         * @since 2.8.0
     40         * @since 5.3.0 Do not display the widget to non-admin users if there are
     41         *                              no RSS items fetched.
    4042         *
    4143         * @param array $args     Display arguments including 'before_title', 'after_title',
    4244         *                        'before_widget', and 'after_widget'.
    class WP_Widget_RSS extends WP_Widget { 
    6668                $desc  = '';
    6769                $link  = '';
    6870
    69                 if ( ! is_wp_error( $rss ) ) {
     71                if ( is_wp_error( $rss ) ) {
     72                        return;
     73                }
     74                else {
     75                        if ( $rss->get_item_quantity() <= 0 && ! current_user_can( 'edit_theme_options' ) ) {
     76                                return;
     77                        }
     78
    7079                        $desc = esc_attr( strip_tags( html_entity_decode( $rss->get_description(), ENT_QUOTES, get_option( 'blog_charset' ) ) ) );
    7180                        if ( empty( $title ) ) {
    7281                                $title = strip_tags( $rss->get_title() );
    class WP_Widget_RSS extends WP_Widget { 
    7685                                $link = substr( $link, 1 );
    7786                        }
    7887                }
    79 
     88               
    8089                if ( empty( $title ) ) {
    8190                        $title = ! empty( $desc ) ? $desc : __( 'Unknown Feed' );
    8291                }