Ticket #4967: 4967.5.diff
File 4967.5.diff, 1.5 KB (added by , 13 years ago) |
---|
-
wp-includes/canonical.php
218 218 $addl_path = !empty( $addl_path ) ? trailingslashit($addl_path) : ''; 219 219 if ( get_query_var( 'withcomments' ) ) 220 220 $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' ); 222 225 $redirect['query'] = remove_query_arg( 'feed', $redirect['query'] ); 223 226 } 224 227 … … 295 298 // Clean up empty query strings 296 299 $redirect['query'] = trim(preg_replace( '#(^|&)(p|page_id|cat|tag)=?(&|$)#', '&', $redirect['query']), '&'); 297 300 301 // Redirect obsolete feeds 302 $redirect['query'] = preg_replace( '#(^|&)feed=(rss|rdf)(&|$)#', '$1feed=rss2$3', $redirect['query'] ); 303 298 304 // Remove redundant leading ampersands 299 305 $redirect['query'] = preg_replace( '#^\??&*?#', '', $redirect['query'] ); 300 306 }