| 1207 | /* |
| 1208 | * Check the queried object for the existence of posts if it is not a feed for an archive |
| 1209 | * or search result. By checking for the absense of posts we can prevent rendering the feed |
| 1210 | * templates at invalid endpoints. e.g.) /wp-content/plugins/feed/ |
| 1211 | */ |
| 1212 | if ( ! $wp_query->have_posts() && ! ( $wp_query->is_archive() || $wp_query->is_post_type_archive() || $wp_query->is_search() ) ) { |
| 1213 | wp_die( __( 'ERROR: This is not a valid feed.' ), '', array( 'response' => 404 ) ); |
| 1214 | } |
| 1215 | |