WordPress.org

Make WordPress Core

Changeset 18537


Ignore:
Timestamp:
08/11/2011 11:30:59 PM (7 years ago)
Author:
markjaquith
Message:

Deprecate RSS 0.92 and RDF feeds, and 301 them to the default feed. props johnpbloch. fixes #4967

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/canonical.php

    r18254 r18537  
    219219                if ( get_query_var( 'withcomments' ) )
    220220                    $addl_path .= 'comments/';
    221                 $addl_path .= user_trailingslashit( 'feed/' . ( ( get_default_feed() ==  get_query_var('feed') || 'feed' == get_query_var('feed') ) ? '' : get_query_var('feed') ), 'feed' );
     221                if( (in_array( get_default_feed(), array( 'rss', 'rdf' ) ) && 'feed' == get_query_var('feed')) || in_array( get_query_var('feed'), array( 'rss', 'rdf' ) ) )
     222                    $addl_path .= user_trailingslashit( 'feed/' . ( ( get_default_feed() == 'rss2' ) ? '' : 'rss2' ), 'feed' );
     223                else
     224                    $addl_path .= user_trailingslashit( 'feed/' . ( ( get_default_feed() ==  get_query_var('feed') || 'feed' == get_query_var('feed') ) ? '' : get_query_var('feed') ), 'feed' );
    222225                $redirect['query'] = remove_query_arg( 'feed', $redirect['query'] );
    223226            }
     
    296299        $redirect['query'] = trim(preg_replace( '#(^|&)(p|page_id|cat|tag)=?(&|$)#', '&', $redirect['query']), '&');
    297300
     301        // Redirect obsolete feeds
     302        $redirect['query'] = preg_replace( '#(^|&)feed=(rss|rdf)(&|$)#', '$1feed=rss2$3', $redirect['query'] );
     303
    298304        // Remove redundant leading ampersands
    299305        $redirect['query'] = preg_replace( '#^\??&*?#', '', $redirect['query'] );
  • trunk/wp-includes/feed.php

    r16660 r18537  
    6464 */
    6565function get_default_feed() {
    66     return apply_filters('default_feed', 'rss2');
     66    $default_feed = apply_filters('default_feed', 'rss2');
     67    return in_array( $default_feed, array( 'rss', 'rdf' ) ) ? 'rss2' : $default_feed;
    6768}
    6869
Note: See TracChangeset for help on using the changeset viewer.