Order WordPress RSS feed by modified rather than published

Published:

Adding the following to the functions.php of your theme should make the posts in your WordPress RSS feed sort by when the post was last modified rather than when it was published. Useful in some cases when you for example want to push out updated posts as well.

function wpse49312_alter_the_query( $request )
{
    $dummy_query = new WP_Query();
    $dummy_query->parse_query($request);

    if($dummy_query->is_feed())
        $request['orderby'] = 'modified';

    return $request;
}
add_filter('request', 'wpse49312_alter_the_query');