如何在WordPress中禁用自我Pingbacks

Linking to your own posts also known as interlinking is great for SEO. However with pingbacks enabled on your site, interlinking posts can become annoying because WordPress automatically creates new pingback for that post. These pingback appear in the comments section of your posts. While some users may like this feature, many users don’t find it useful. In this article, we will show you how to disable self pingbacks in WordPress.

链接到您自己的帖子(也称为链接)非常适合SEO。 但是,在您的网站上启用pingback后,由于WordPress会自动为该帖子创建新的pingback,因此链接链接的帖子会变得很烦人。 这些pingback出现在您帖子的评论部分。 虽然某些用户可能喜欢此功能,但许多用户并不觉得它有用。 在本文中,我们将向您展示如何在WordPress中禁用自我pingbacks。

Disable Self Pings
什么是Pingback? (What is a Pingback?)

Pingbacks give softwares the ability to communicate between websites. Its almost like remote comments. Think of it like this:

pingbacking使软件能够在网站之间进行通信。 它几乎像远程注释。 这样想:

  1. We write a post on WPBeginner blog.

    我们在WPBeginner博客上写了一篇文章。
  2. Then you write a post on your blog mentioning/linking to our article.

    然后,您会在博客上写一篇提及/链接到我们文章的文章。
  3. Your blogging software (WordPress) will automatically send us a pingback.

    您的博客软件(WordPress)将自动向我们发送pingback。
  4. Our blogging software (WordPresS) will receive the ping. It will then automatically go to your blog to confirm that the pingback originates there (check if the link is present).

    我们的博客软件(WordPresS)将收到ping命令。 然后,它将自动转到您的博客,以确认pingback源自那里(检查链接是否存在)。
  5. Then we will have the ability to display your pingback as a comment on our post. This will solely be a link to your site.

    然后,我们将能够显示您的pingback作为对我们帖子的评论。 这仅是指向您网站的链接。

Pingbacks also work within your site. So if one of your posts link to another post, then your WordPress will send a self-ping. This can get really annoying.

pingbacks也可以在您的站点中使用。 因此,如果您的其中一个帖子链接到另一篇文章,那么您的WordPress将发送自查功能。 这会变得很烦人。

Self Pingbacks on a WordPress site

Fore more details, take a look at our guide about trackbacks and pingbacks.

有关更多详细信息,请参阅有关引用和pingback的指南。

Now that you know what is a pingback, let’s take a look at how to disable self pingbacks.

现在您知道了什么是pingback,让我们看一下如何禁用自我pingback。

影片教学 (Video Tutorial)

演示地址

If you don’t like the video or need more instructions, then continue reading.

如果您不喜欢该视频或需要更多说明,请继续阅读。

There are multiple ways you can disable self pingbacks on your WordPress site. We will show you both plugin method and manual code method.

您可以通过多种方式在WordPress网站上禁用自我pingbacks。 我们将向您展示插件方法和手动代码方法。

使用插件在WordPress中禁用自我Pingbacks (Disable Self Pingbacks in WordPress Using Plugins)

There are two plugins that you can use to turn off self pings.

您可以使用两个插件来关闭自查功能。

1. Using No Self Pings Plugin

1.不使用自我Pings插件

First thing you need to do is install and activate the No Self Pings plugin. The plugin works out of the box, and there are no settings for you to configure. Simply activating the plugin will turn off self pingbacks.

您需要做的第一件事是安装并激活No Self Pings插件。 该插件可以直接使用,没有可供您配置的设置。 只需激活插件即可关闭自我pingbacks。

You will notice that No Self Pings plugin hasn’t been updated for more than two years. Usually we do not recommend installing plugins that haven’t been updated this long. Simply because in most cases those plugins do not work. However, No Self Pings is very simple plugin, and it works even with the latest version of WordPress (4.2.3 At the time of writing this article).

您会注意到No Self Pings插件两年多没有更新了。 通常,我们不建议您安装尚未更新很久的插件。 仅仅是因为在大多数情况下,这些插件无法正常工作。 但是,No Self Pings是一个非常简单的插件,即使在最新版本的WordPress(撰写本文时为4.2.3)中也可以使用。

We recommend you to read our guide on the issue of installing plugins not tested with your WordPress version.

我们建议您阅读有关未使用WordPress版本测试的插件安装问题的指南。

2. Using Disabler Plugin

2.使用Disabler插件

Simply install and activate the Disabler plugin. Upon activation, visit Settings » Disabler page to configure the plugin.

只需安装并激活Disabler插件即可。 激活后,访问设置»禁用者页面以配置插件。

Disabler plugin settings page

You will notice that the plugin allows you to turn off several WordPress features. You need to scroll down to Back End Settings section and check the box next to Disable self pings option.

您会注意到,该插件允许您关闭一些WordPress功能。 您需要向下滚动到“后端设置”部分,然后选中“ 禁用自ping”选项旁边的框。

Click on the save changes button to store your settings.

单击保存更改按钮以存储您的设置。

在不使用插件的情况下关闭自ping (Turn Off Self Pings Without Using a Plugin)

If you do not want to use a plugin, then you can use these two methods to turn off self pings on your site.

如果您不想使用插件,则可以使用这两种方法在网站上关闭自我ping。

1. Turn off Pingbacks Globally

1.全局关闭Pingbacks

WordPress allows you to turn off pingbacks on your site. By using this option will disable pingback feature completely on your site.

WordPress允许您关闭站点上的pingback。 使用此选项将完全禁用站点上的pingback功能。

Simply go to Settings » Discussion page. Under the Default article settings section, uncheck the box next to ‘Attempt to notify any blogs linked to from the article’ option. Click on the save changes button to store your settings.

只需转到设置»讨论页面。 在“ 默认文章设置”部分下,取消选中“尝试通知与该文章链接的任何博客”选项旁边的框。 单击保存更改按钮以存储您的设置。

Disable all outgoing pinbacks from your site

2. Manually Insert Code to Disable Self Pingbacks

2.手动插入代码以禁用自我Pingbacks

If you are comfortable with adding code snippets to your WordPress theme files, then you can use this method to switch off self pings.

如果您愿意在WordPress主题文件中添加代码段,则可以使用此方法关闭自查功能。

Simply copy and paste this code in your theme’s functions.php file or a site-specific plugin.

只需将此代码复制并粘贴到主题的functions.php文件或特定站点的插件中即可


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' );

That’s all, we hope this article helped you disable self pings on your WordPress site. You may also want to check our guide on how to put a stop on WordPress trackback spam.

仅此而已,我们希望本文能帮助您在WordPress网站上禁用自查功能。 您可能还需要查看有关如何停止WordPress引用垃圾邮件的指南

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

如果您喜欢这篇文章,请订阅我们的YouTube频道 WordPress视频教程。 您也可以在TwitterFacebook上找到我们。

翻译自: https://www.wpbeginner.com/wp-tutorials/how-disable-self-pingbacks-in-wordpress/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值