From c957e3acb04847abcb87a1ca6c1a08848b561908 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Sun, 29 Jan 2017 23:09:41 +0000 Subject: [PATCH] Feeds: Prevent empty feeds from returning 404 errors. Partial revert of [38929]. This reverts the source code from the commit for #30210 to prevent valid but empty feeds from returning 404 file not found errors for the home and custom feeds. The tests in the commit that remain applicable are retained. Props pavelevap for reporting, stevenkword for initial patch. See #30210. Fixes #39157. Built from https://develop.svn.wordpress.org/trunk@40030 git-svn-id: http://core.svn.wordpress.org/trunk@39967 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 12 ------------ wp-includes/version.php | 2 +- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 34d38dafd6..3923ca92ec 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1213,18 +1213,6 @@ function bool_from_yn( $yn ) { function do_feed() { global $wp_query; - // Determine if we are looking at the main comment feed - $is_main_comments_feed = ( $wp_query->is_comment_feed() && ! $wp_query->is_singular() ); - - /* - * Check the queried object for the existence of posts if it is not a feed for an archive, - * search result, or main comments. By checking for the absense of posts we can prevent rendering the feed - * templates at invalid endpoints. e.g.) /wp-content/plugins/feed/ - */ - if ( ! $wp_query->have_posts() && ! ( $wp_query->is_archive() || $wp_query->is_search() || $is_main_comments_feed ) ) { - wp_die( __( 'ERROR: This is not a valid feed.' ), '', array( 'response' => 404 ) ); - } - $feed = get_query_var( 'feed' ); // Remove the pad, if present. diff --git a/wp-includes/version.php b/wp-includes/version.php index 7662753291..b99db66045 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.8-alpha-40029'; +$wp_version = '4.8-alpha-40030'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.