How to Ignore Bloglovin’ RSS Frame in your WordPress Blog

Bloglovin'

Bloglovin’ is a RSS-based platform that keeps you updated with all your favorite blogs. To use it, you have to build your profile by adding the blogs you want to “follow”. Then, Bloglovin’ sends you an email every time there’s a new blogpost.

All’s good, right? But, wait a moment! If you try to read a blogpost, you’ll notice that it opens in a RSS frame and it doesn’t redirect to the source site. For example, the URL of a post would look something like this:

Frame

From the reader’s perspective, this might be not important! Imagine however that you’re a blogger, you know that your blog gets traffic, but for some unexplained reason your pageviews are very low. Of course, that happens because Bloglovin’ “steals” all your traffic by wrapping the blogposts within its feed frame.

To avoid it and force readers to visit the original source for reading the blogpost, you have to add the following code snippet to your functions.php file of your WordPress theme:

// Break Out of Frames for WordPress
function break_out_of_frames() {
    if (!is_preview()) {
        echo "\n<script type=\"text/javascript\">";
        echo "\n<!--";
        echo "\nif (parent.frames.length > 0) { parent.location.href = location.href; }";
        echo "\n-->";
        echo "\n</script>\n\n";
    }
}
add_action('wp_head', 'break_out_of_frames');

Source: http://www.catswhocode.com/blog/useful-snippets-to-protect-your-wordpress-blog-against-scrapers

Posted on June 12, 2015 in Know how by

A picture of George Martsoukos

George is an enthusiast web developer with passion about all the emerging web technologies.

Back to Top