让WordPress不在自己Pingback自己

0

No-Self-Pings
WordPress的Pingback的功能不错,但是WP有个毛病就是自己Ping自己,于是就有了No Self Pings,不过本着插脚越少越好的原则,提取插件中的代码添加到模板里就可以了。

编辑当前模板的functions.php文件,在底部加入

1
2
3
4
5
6
7
8
9
//取消自己PING自己
function no_self_ping(&$links) {
    $home = get_option('home');
    foreach ($links as $l => $link )
        if (0 === strpos($link, $home))
            unset($links[$l]);
} 
 
add_action( 'pre_ping', 'no_self_ping' );

发表评论

您的邮箱不会公开,当您的评论有新的回复时,会通过您填写的邮箱向您发送评论内容。 必填字段 *

为何看不到我发布的评论?

正在提交, 请稍候...