Skip to content

Instantly share code, notes, and snippets.

@noyb34
Created April 17, 2013 01:26
Show Gist options
  • Save noyb34/5401086 to your computer and use it in GitHub Desktop.
Save noyb34/5401086 to your computer and use it in GitHub Desktop.
This function snippet helps break out frames, so your pages are served only from the original domain not some douchebag's Google adsense site
// 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');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment