Make WordPress Core

Ticket #30210: 30210.4.patch

File 30210.4.patch, 834 bytes (added by stevenkword, 8 years ago)

Adds support for custom post archives

  • src/wp-includes/functions.php

     
    12041204function do_feed() {
    12051205        global $wp_query;
    12061206
     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
    12071216        $feed = get_query_var( 'feed' );
    12081217
    12091218        // Remove the pad, if present.