Deprecate RSS 0.92 and RDF feeds, and 301 them to the default feed. props johnpbloch. fixes #4967
git-svn-id: http://svn.automattic.com/wordpress/trunk@18537 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ae91e0dfcd
commit
7689657c90
|
@ -218,6 +218,9 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
|
|||
$addl_path = !empty( $addl_path ) ? trailingslashit($addl_path) : '';
|
||||
if ( get_query_var( 'withcomments' ) )
|
||||
$addl_path .= 'comments/';
|
||||
if( (in_array( get_default_feed(), array( 'rss', 'rdf' ) ) && 'feed' == get_query_var('feed')) || in_array( get_query_var('feed'), array( 'rss', 'rdf' ) ) )
|
||||
$addl_path .= user_trailingslashit( 'feed/' . ( ( get_default_feed() == 'rss2' ) ? '' : 'rss2' ), 'feed' );
|
||||
else
|
||||
$addl_path .= user_trailingslashit( 'feed/' . ( ( get_default_feed() == get_query_var('feed') || 'feed' == get_query_var('feed') ) ? '' : get_query_var('feed') ), 'feed' );
|
||||
$redirect['query'] = remove_query_arg( 'feed', $redirect['query'] );
|
||||
}
|
||||
|
@ -295,6 +298,9 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
|
|||
// Clean up empty query strings
|
||||
$redirect['query'] = trim(preg_replace( '#(^|&)(p|page_id|cat|tag)=?(&|$)#', '&', $redirect['query']), '&');
|
||||
|
||||
// Redirect obsolete feeds
|
||||
$redirect['query'] = preg_replace( '#(^|&)feed=(rss|rdf)(&|$)#', '$1feed=rss2$3', $redirect['query'] );
|
||||
|
||||
// Remove redundant leading ampersands
|
||||
$redirect['query'] = preg_replace( '#^\??&*?#', '', $redirect['query'] );
|
||||
}
|
||||
|
|
|
@ -63,7 +63,8 @@ function bloginfo_rss($show = '') {
|
|||
* @return string Default feed, or for example 'rss2', 'atom', etc.
|
||||
*/
|
||||
function get_default_feed() {
|
||||
return apply_filters('default_feed', 'rss2');
|
||||
$default_feed = apply_filters('default_feed', 'rss2');
|
||||
return in_array( $default_feed, array( 'rss', 'rdf' ) ) ? 'rss2' : $default_feed;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue