一、关掉feed
放到wordpress主题的functions.php文件中
1 2 3 4 5 6 7 8 9 |
//禁用 feed function disable_our_feeds() { wp_die( __('Error: No RSS Feed Available, Please visit our homepage.')); } add_action('do_feed', 'disable_our_feeds', 1); add_action('do_feed_rdf', 'disable_our_feeds', 1); add_action('do_feed_rss', 'disable_our_feeds', 1); add_action('do_feed_rss2', 'disable_our_feeds', 1); add_action('do_feed_atom', 'disable_our_feeds', 1); |
二、不让手动复制:
把下面这段代码放到wordpress主题的header.php文件的标签前:
(但:如果对方浏览器禁用了JS,那这个就没效果了)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
<script> function stop(){ return false; } document.oncontextmenu=stop; document.ondragstart=stop; document.onselectstart=stop; document.onkeydown = function (e) { var ev = window.event,| e; var code = ev.keyCode,| ev.which; if (code == 116) { ev.keyCode ? ev.keyCode = 0 : ev.which = 0; cancelBubble = true; return false; } } </script> |
三、就算被复制,也要带个尾巴
1 2 3 4 5 6 7 |
// 内页添加转载请注明 function tedlfie_copyright($content) { if( is_single()){ $content.= '<p class="post-copy"><span style="color:#f00;">转载请注明:</span><a href="'.get_permalink().'" rel="external nofollow" target="_blank">'.get_the_title().'</a> - <a href="'.get_bloginfo('url').'" rel="external nofollow" target="_blank">'.get_bloginfo('name').'</a></p>'; } return $content; } |