I’ve recently come across a slight problem with one of my clients whereby they wanted the RSS feed widget to open all incoming links in a new window. And why wouldn’t they? Especially if they’re external RSS feeds that are being parsed.

We could have used the Better RSS plugin, but until I knew that I had to poke around and see whether it was possible. Of course it was. Here’s what you need to do.

Open WordPress RSS Feed using an additional target=”_blank” command

Find around line 898 of defaults-widgets.php in your wp-includes folder.

Replace:

if ( $link == '' ) {
echo "

  • $title{$date}{$summary}{$author}
  • ";
    } else {
    echo "

  • $title{$date}{$summary}{$author}
  • ";
    }

    With:

    if ( $link == '' ) {
    echo "

  • $title{$date}{$summary}{$author}
  • ";
    } else {
    echo "

  • $title{$date}{$summary}{$author}
  • ";
    }

    And you’re done! Of course, future WordPress updates could break this so it might be best to either create a function or use an alternative, but I thought I’d add it just for reference.