Deprecate RSS 0.92 and RDF feeds, and 301 them to the default feed. props johnpbloch. fixes #4967
git-svn-id: https://develop.svn.wordpress.org/trunk@18537 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
7fe1e0fc4a
commit
47bf346a9f
|
@ -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