wordpress插件_如何为WordPress插件启用自动更新

wordpress插件

Recently one of our readers asked how they can automatically update WordPress plugins. Many users find it annoying that almost every other day they have to update a plugin. In this article, we will show you how to enable automatic updates for WordPress plugins. We will also show you how to exclude some plugins from automatic updates.

最近,我们的一位读者问他们如何自动更新WordPress插件。 许多用户感到烦恼的是,几乎每隔一天他们就必须更新一个插件。 在本文中,我们将向您展示如何为WordPress插件启用自动更新。 我们还将向您展示如何从自动更新中排除某些插件。

How to Enable Automatic Updates for WordPress Plugins
什么时候以及为什么您应该自动更新WordPress插件? (When and Why You Should Automatically Update WordPress Plugins?)

By default WordPress can automatically update itself when a security or minor release is available. For major releases, you have to initiate the update yourself. You also have to install plugin and theme updates yourself.

默认情况下,当安全性或次要版本可用时,WordPress可以自动更新自身。 对于主要版本,您必须自己启动更新。 您还必须自己安装插件和主题更新。

Keeping your WordPress site updated is crucial for security and stability of your site. See our guide on why you should always use the latest version of WordPress.

保持WordPress网站更新对您网站的安全性和稳定性至关重要。 请参阅我们的指南, 了解为什么您应始终使用最新版本的WordPress

Same goes for all plugins and themes installed on your website. You need to install updates for themes and plugins to get new features and fixes.

网站上安装的所有插件和主题也是如此。 您需要为主题和插件安装更新以获取新功能和修复。

However, you may have noticed that some of them are updated more frequently than others. A lot of popular plugins are updated almost weekly.

但是,您可能已经注意到其中一些更新得比其他更新更频繁。 许多流行的插件几乎每周都会更新。

WordPress updates

Some users find it a bit distracting, that whenever they login there is an update available for one or more plugins.

一些用户发现它有些分心,他们每次登录都会有一个或多个插件的更新。

What if you could allow trusted developers to auto-update plugins similar to WordPress.

如果您可以允许受信任的开发人员自动更新类似于WordPress的插件,该怎么办。

Let’s take a look at how you can automatically update plugins in WordPress.

让我们看一下如何在WordPress中自动更新插件。

为所有WordPress插件设置自动更新 (Setting up Automatic Update for All WordPress Plugins)

You can set WordPress to automatically install all plugin updates by simply adding this code to your theme’s functions.php file or a site-specific plugin.

您可以将WordPress设置为自动安装所有插件更新,只需将该代码添加到主题的functions.php文件或特定站点的插件中即可


add_filter( 'auto_update_plugin', '__return_true' );

This filter tells WordPress automatic updater to automatically install plugin updates when they’re available.

此过滤器告诉WordPress自动更新程序在可用时自动安装插件更新。

If you also want to automatically update your themes, then you can add another code like this:

如果您还想自动更新主题,则可以添加另一个代码,如下所示:


add_filter( 'auto_update_theme', '__return_true' );

如何在WordPress中自动安装某些插件的更新 (How to Automatically Install Updates for Some Plugins in WordPress)

If there are a few plugins that are updated more frequently, then you may want to just enable automatic updates for those plugins.

如果有一些插件的更新频率更高,那么您可能只想为这些插件启用自动更新。

Another situation is when you don’t want to update specific plugins.

另一种情况是您不想更新特定的插件。

Here is how you can include or exclude plugins from automatic updates.

这是您可以在自动更新中包括或排除插件的方法。

First thing you need to do is install and activate the Automatic Plugin Updates plugin. For more details, see our step by step guide on how to install a WordPress plugin.

您需要做的第一件事是安装并激活“ 自动插件更新”插件。 有关更多详细信息,请参阅有关如何安装WordPress插件的分步指南。

Upon installation, you need to visit Settings » Automatic Plugin Updates page to configure plugin settings.

安装后,您需要访问设置»自动插件更新页面以配置插件设置。

Exclude plugins from automatic update

You can select the plugins you don’t want to automatically update. You can also enable email notifications for Automatic updates. Once you are done, click on the save changes button to store your settings.

您可以选择不想自动更新的插件。 您还可以启用自动更新的电子邮件通知。 完成后,单击保存更改按钮以存储您的设置。

That’s all, the plugin will now automatically update all plugins except for the ones you have excluded.

就是这样,除了您已排除的插件之外,该插件现在将自动更新所有插件。

Note If you are using this plugin, then you don’t need to use the previous method of adding auto_update_plugin filter.

注意如果使用的是此插件,则无需使用以前的方法添加auto_update_plugin过滤器。

更新后如何回滚到插件的先前版本? (How to Rollback to a Previous Version of Plugin After Update?)

Plugin or theme incompatibilities can cause trouble for your website. Even though most good developers thoroughly test their plugins, there are always rare bugs that can cause your site to break.

插件或主题不兼容会给您的网站带来麻烦。 即使大多数优秀的开发人员都对其插件进行了彻底的测试,但总会有一些罕见的错误会导致您的网站崩溃。

The first step you should take to protect your website is to install a WordPress backup solution.

保护网站的第一步是安装WordPress备份解决方案。

However, restoring your WordPress site from a backup seems like a lot of work. If you know what plugin or theme update caused the problem, then it would be easier to just rollback the update.

但是, 从备份还原WordPress网站似乎需要很多工作。 如果您知道是什么插件或主题更新引起了该问题,那么回滚更新会更容易。

Here is how you can easily rollback plugin or theme updates. Simply install and activate the WP Rollback plugin.

这是您可以轻松回滚插件或主题更新的方法。 只需安装并激活WP Rollback插件即可。

Upon activation, go back to plugins page on your WordPress site. You will notice a new Rollback option below each plugin installed on your site.

激活后,返回WordPress网站上的插件页面。 您会在网站上安装的每个插件下方看到一个新的“回滚”选项。

Rollback plugin's to previous versions

Clicking on Rollback will allow you to rollback your plugin to any previous version you want. It can also rollback theme updates. For more detailed instructions see our guide on how to rollback WordPress plugins.

单击“回滚”将允许您将插件回滚到所需的任何先前版本。 它还可以回滚主题更新。 有关更详细的说明,请参阅有关如何回滚WordPress插件的指南。

We hope this article helped you setup automatic updates for plugins in WordPress. You may also want to see our guide on how to enable automatic updates in WordPress for major releases.

我们希望本文能帮助您为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/plugins/how-to-enable-automatic-updates-for-wordpress-plugins/

wordpress插件

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值