WordPress RSS Widget: Open Links in a New Window

/WordPress RSS Widget: Open Links in a New Window

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.


    if ( $link == '' ) {
      echo "<li>$title{$date}{$summary}{$author}</li>";
    } else {
      echo "<li><a class='rsswidget' href='$link' title='$desc'>$title</a>{$date}{$summary}{$author}</li>";


    if ( $link == '' ) {
      echo "<li>$title{$date}{$summary}{$author}</li>";
    } else {
      echo "<li><a class='rsswidget' target='_blank' href='$link' title='$desc'>$title</a>{$date}{$summary}{$author}</li>";

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.

2018-02-02T03:09:34+00:00June 4th, 2013|PHP Snippets, WordPress Snippets|1 Comment

About the Author:

Warren Chandler is a freelance web programmer and web developer, based in Frinton on Sea, Essex. Warren specialises in web programming, web design, corporate identity, copy writing, SEO, logo and print media for home, work, and mobile platforms.

One Comment

  1. John Peterson September 20, 2013 at 8:11 pm - Reply

    Warren’s article and suggestion worked! Fast and easy, the way it should be! Problem is, most people had a very long and drawn out explanation on how to open a new window with an RSS Feed in WordPress?.It would be great if most people even knew how to write an article or post, let alone explaining how to do something!
    Thank you Warren!!

Leave A Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.