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 { |
37 | 37 | * Outputs the content for the current RSS widget instance. |
38 | 38 | * |
39 | 39 | * @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. |
40 | 42 | * |
41 | 43 | * @param array $args Display arguments including 'before_title', 'after_title', |
42 | 44 | * 'before_widget', and 'after_widget'. |
… |
… |
class WP_Widget_RSS extends WP_Widget { |
66 | 68 | $desc = ''; |
67 | 69 | $link = ''; |
68 | 70 | |
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 | |
70 | 79 | $desc = esc_attr( strip_tags( html_entity_decode( $rss->get_description(), ENT_QUOTES, get_option( 'blog_charset' ) ) ) ); |
71 | 80 | if ( empty( $title ) ) { |
72 | 81 | $title = strip_tags( $rss->get_title() ); |
… |
… |
class WP_Widget_RSS extends WP_Widget { |
76 | 85 | $link = substr( $link, 1 ); |
77 | 86 | } |
78 | 87 | } |
79 | | |
| 88 | |
80 | 89 | if ( empty( $title ) ) { |
81 | 90 | $title = ! empty( $desc ) ? $desc : __( 'Unknown Feed' ); |
82 | 91 | } |