使用iframe框架引用网页,是某些不法分子的“钓鱼”手段。如果你发现自己的WordPress站点网页被另外非授权网站框架引用,改如何应对?很简单,将下面的代码添加到你的WordPress主题的 functions.php 即可:
// 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'); |
来源:
https://www.wpdaxue.com/break-out-of-frames-for-wordpress.html