wordpress插件_更新WordPress,插件和主题的指南

wordpress插件

WordPress is a great CMS and continues to grow in popularity. Like anything though, it’s not perfect. We all have different needs and WordPress out of the box cannot satisfy all of them. That’s why plugins and themes exist.

WordPress是一个很棒的CMS,并且持续流行。 像其他任何东西一样,它并不完美。 我们都有不同的需求,WordPress开箱即用不能满足所有需求。 这就是存在插件和主题的原因。

If you use WordPress, chances are that you have installed plugins and themes to satisfy your particular needs. There are thousands of plugins and themes publicly available on WordPress.org and other third party websites but installing a plugin, a theme, or even WordPress itself, is just the first step.

如果您使用WordPress,则很可能已经安装了插件和主题来满足您的特定需求。 WordPress.org和其他第三方网站上公开提供了成千上万的插件和主题,但是安装插件,主题甚至WordPress本身只是第一步。

WordPress is a living project. Developers work hard on this CMS to provide us with a reliable platform and we can say the same thing for many of the plugins or themes available. However, there can be problems with any software. Some of those are user errors, and can be avoided by making WordPress simpler for your users. Some, though, are bugs that are introduced or discovered in your plugins or themes. To use newly developed features or to prevent potential bugs or remove existing ones, you should be keeping things up to date. Updating WordPress core as well as your themes and plugins is important, and that’s what we’ll cover in this article.

WordPress是一个有生命的项目。 开发人员在此CMS上努力为我们提供可靠的平台,对于许多可用的插件或主题,我们可以说同样的话。 但是,任何软件都可能存在问题。 其中一些是用户错误,可以通过使WordPress对您的用户更简单避免 。 但是,有些是在插件或主题中引入或发现的错误。 要使用新开发的功能或防止潜在的错误或删除现有的功能,应保持最新状态。 更新WordPress核心以及您的主题和插件很重要,这就是我们将在本文中介绍的内容。

为什么要更新? (Why Update?)

WordPress and its plugins and themes are like any other software installed on your computer, or like any other application on your devices. Periodically developers release updates which provide new features or fix known bugs.

WordPress及其插件和主题就像您计算机上安装的任何其他软件,或设备上的任何其他应用程序一样。 开发人员会定期发布提供新功能或修复已知错误的更新。

Maybe new features is not something that you necessarily want? In fact, maybe you are satisfied with the functionality you currently have and you don’t need more? Well, you are still likely to be concerned about bugs.

也许您不一定想要新功能? 实际上,也许您对当前拥有的功能感到满意,而您不需要更多的功能了? 好吧,您仍然可能会担心错误。

Software bugs can come in many shapes and sizes. A bug could be enormous such as preventing users from using a plugin or it could be very small and only concern a certain part of a theme for example. In some cases, bugs can even be serious security holes.

软件错误可能有多种形式和大小。 一个错误可能很大,例如阻止用户使用插件,或者它很小,并且仅涉及主题的某个部分。 在某些情况下,错误甚至可能是严重的安全漏洞。

Regardless of their level of severity, software bugs must be fixed. As a user, when a software update is released that fixes a bug, you should update as soon as possible to have the most secure and stable versions of the product.

无论其严重程度如何,都必须修复软件错误。 作为用户,在发布解决错误的软件更新时,您应尽快进行更新,以获取产品的最安全和稳定的版本。

The same goes for WordPress and it’s themes and plugins. It’s not difficult to update, so what is stopping you?

WordPress及其主题和插件也是如此。 更新并不难,那么什么阻止了您?

如何知道是否有可用的更新? (How to Know If There Are Updates Available?)

As I mentioned earlier, updating our software is important, but we can’t monitor everyday if a new version is available for WordPress or for one of our plugins or themes, especially if we are using a lot of them.

正如我之前提到的,更新软件很重要,但是如果有新版本可用于WordPress或我们的插件或主题之一,尤其是如果我们使用了大量插件或主题,我们就无法每天监控。

Fortunately, if a new version of WordPress is available, you can’t miss it, as you will see a message at the top of almost every page of your administration panel. You will even see another message at the bottom of these pages!

幸运的是,如果有新版本的WordPress,您将不会错过它,因为您将在管理面板几乎每个页面的顶部看到一条消息。 您甚至会在这些页面的底部看到另一条消息!

New Version Available
Get New Version

For plugins and themes, it is different, but if they are available on WordPress.org, then the CMS can tell you if a new version is released. All you have to do is visit the ‘Updates’ section of the WordPress dashboard.

对于插件和主题,情况有所不同,但是如果可以在WordPress.org上使用它们,则CMS可以告诉您是否发布了新版本。 您所要做的就是访问WordPress信息中心的“更新”部分。

You will see right next to this entry in the menu, how many updates are available. This number also appears in the bar at the top of your screen on all the pages of your website when you are logged in. If this number doesn’t appear, good news: WordPress and all your plugins and themes are up to date!

您会在菜单中此条目的旁边看到,有多少个更新可用。 登录时,该数字还会显示在网站所有页面的屏幕顶部栏中。如果未出现该数字,则是个好消息:WordPress以及您的所有插件和主题都是最新的!

Updates Number

更新WordPress (Updating WordPress)

Updating WordPress itself is very important, as the CMS is victim of its success. Used by millions of people around the world, WordPress is a good target: a single security hole can affect many websites.

更新WordPress本身非常重要,因为CMS是其成功的受害者。 WordPress已被全球数百万人使用,是一个不错的目标:单个安全漏洞可能会影响许多网站。

Fortunately, WordPress is Open Source and security flaws can be detected and fixed quickly. However, in order to be safe, you have to update your installation.

幸运的是,WordPress是开放源代码,可以快速检测并修复安全漏洞。 但是,为了安全起见,您必须更新安装。

To update WordPress, you have to add, delete and replace some files, manually or automatically. If a problem occurs when you are updating your installation, WordPress can be broken and I’m sure that it’s not what you want!

要更新WordPress,您必须手动或自动添加,删除和替换一些文件。 如果在更新安装时出现问题,则WordPress可能会损坏,并且我确定这不是您想要的!

That’s why you should back up your WordPress installation before updating it, to be sure that you can retrieve the old but working installation.

这就是为什么您应该在更新之前备份WordPress安装,以确保可以检索到旧的但可以使用的安装。

一键更新WordPress (Updating WordPress with a Single Click)

Since version 2.7, it is possible to update WordPress quickly and easily thanks to a one click method. This method is preferred, as WordPress will automatically download and replace the right files by itself. That way, you avoid errors and gain time.

从2.7版开始,借助一键式方法就可以快速轻松地更新WordPress。 此方法是首选方法,因为WordPress会自动自动下载并替换正确的文件。 这样,您可以避免错误并节省时间。

To update WordPress in one click, go in the ‘Updates’ entry of the ‘Dashboard’ menu. If you don’t have the latest available version of WordPress, you will see the message ‘An updated version of WordPress is available’ before two buttons.

要一键更新WordPress,请进入“仪表盘”菜单的“更新”条目。 如果没有最新可用的WordPress版本,则会在两个按钮之前看到消息“可用WordPress的更新版本”。

By clicking on the second button, you will download a ZIP archive containing the latest version of WordPress. You will then be able to create a new installation of WordPress or manually update your current installation (which is described below).

通过单击第二个按钮,您将下载一个包含最新版本WordPress的ZIP存档。 然后,您将能够创建WordPress的新安装或手动更新当前安装(如下所述)。

Update Now

The first button is the one click method. If you click on the ‘Update Now’ button, WordPress will lead you to another page which will inform you of the progress: automatically, it will download the latest version, deactivate your plugins, replace the right files and reactivate your plugins. All you have to do is wait just a few seconds or minutes.

第一个按钮是单击方法。 如果单击“立即更新”按钮,WordPress将带您到另一个页面,该页面将向您通知进度:自动下载最新版本,停用插件,替换正确的文件并重新激活插件。 您所要做的就是等待几秒钟或几分钟。

自动更新WordPress (Automatically Updating WordPress)

With version 3.7, WordPress introduced automatic updates. Thanks to this feature, the CMS will check everyday if a new minor version of WordPress is available. If that is the case, it will download and install it alone, without you to have anything to do, not even a click.

在3.7版中,WordPress引入了自动更新。 借助此功能,CMS会每天检查WordPress的新次要版本是否可用。 如果是这种情况,它将单独下载并安装它,而您无需做任何事情,甚至无需单击。

By default, if the latest available version is a major version, you will still have to update by yourself, in one click or manually, but you can be sure to always have the latest stable subversion of WordPress.

默认情况下,如果最新的可用版本是主要版本,则仍然需要您一次或一次手动更新,但是您可以确保始终拥有WordPress的最新稳定版本。

For example, if you use WordPress 4.0 and a version 4.0.1 is available, WordPress will install it automatically. But if the new version is something like 4.1, it won’t.

例如,如果您使用WordPress 4.0,并且有可用的4.0.1版本,则WordPress将自动安装它。 但是,如果新版本是4.1,则不会。

Always having the latest version is important and if a minor update is available, you should update as soon as possible, as minor updates fix bugs. That’s why automatic updates are useful, because you don’t have to worry about having the latest fixes or not: you can be sure it is the case.

始终拥有最新版本很重要,如果有次要更新,则应尽快更新,因为次要更新可修复错误。 这就是自动更新之所以有用的原因,因为您不必担心是否拥有最新的修复程序:您可以肯定是这种情况。

Automatic updates are enabled by default. But if you want to disable them, it is still possible to by adding a new constant in your wp-config.php file at the root of your WordPress installation.

默认情况下启用自动更新。 但是,如果要禁用它们,仍然可以通过在WordPress安装目录的wp-config.php文件中添加新常量来实现。

define('AUTOMATIC_UPDATER_DISABLED', true);

Defining another constant, you can even enable the automatic method for major updates. Still in the wp-config.php file, adding the following line:

定义另一个常量,您甚至可以为主要更新启用自动方法。 仍在wp-config.php文件中,添加以下行:

define('WP_AUTO_UPDATE_CORE', true);

It will automatically update WordPress when a new release is available, whether minor or major. If you use a development version of WordPress, development updates will also be automatic with this constant.

新版本(次要或主要)可用时,它将自动更新WordPress。 如果您使用WordPress的开发版本,则使用此常量也将自动进行开发更新。

This constant can take three different values: true, to enable automatic minor, major and development updates, false, to disable all of them, or 'minor' to only enable automatic minor updates (which is the default behavior).

该常量可以采用三个不同的值: true ,启用自动的次要,主要和开发更新, false ,禁用所有这些更新,或'minor'仅启用自动的次要更新(这是默认行为)。

If you don’t want to edit the wp-config.php file for some reason, you can also enable or disable automatic updates with filters.

如果由于某种原因不想编辑wp-config.php文件,还可以启用或禁用带有过滤器的自动更新。

For example, the AUTOMATIC_UPDATER_DISABLED constant seen above can be replaced by adding the following line in the functions.php file of your theme, or in a plugin:

例如,可以通过在主题的functions.php文件或插件中添加以下行来替换上面看到的AUTOMATIC_UPDATER_DISABLED常量:

add_filter('automatic_updater_disabled', '__return_true');

This will disable automatic updates.

这将禁用自动更新。

Other filters can enable or disable specific automatic updates. For each filter, your function must return true if you want to enable the corresponding type of update, or false otherwise.

其他过滤器可以启用或禁用特定的自动更新。 对于每个过滤器,如果要启用相应的更新类型,则函数必须返回true否则返回false

// Disable automatic minor updates
add_filter('allow_minor_auto_core_updates', '__return_false');

// Enable automatic major updates
add_filter('allow_major_auto_core_updates', '__return_true');

// Enable development updates
add_filter('allow_dev_auto_core_updates', '__return_true');

手动更新WordPress (Manually Updating WordPress)

You should always opt for automatic or one click methods to update WordPress. However, it is of course still possible to update the CMS manually, if you wish or if you have no choice for some particular reason.

您应该始终选择自动或一键式方法来更新WordPress。 但是,如果您愿意或出于某些特殊原因而没有选择,当然仍然可以手动更新CMS。

Be careful: you’re a human (I think!), so you can make errors and break your installation, so please be sure to follow the instructions step by step. Moreover, remember that backing up your installation first is always a good idea.

请注意:您是人类(我认为!),因此您可能会出错并破坏安装,因此请务必按照步骤进行操作。 此外,请记住,首先备份安装始终是一个好主意。

  1. Download the latest version of WordPress. You can do that with the button we saw when we described how to update in one click, or you can download it from WordPress.org. You will get an archive, so unpack it.

    下载最新版本的WordPress。 您可以使用描述一键式更新时看到的按钮来执行此操作,也可以从WordPress.org下载该按钮。 您将获得一个档案,因此将其解压缩。

  2. To be sure that a plugin won’t cause a bug during the update, deactivate all the plugins you use. You can do this quickly thanks to the option ‘Deactivate’ in the drop down list that you can use after selecting all of your plugins.

    为确保插件在更新期间不会导致错误,请停用所有使用的插件。 由于选择了所有插件后可以使用下拉列表中的“停用”选项,因此您可以快速完成此操作。

  3. Now you have to replace the right files. In your current installation, delete the wp-includes and wp-admin folders. Then upload the new ones.

    现在,您必须替换正确的文件。 在当前安装中,删除wp-includeswp-admin文件夹。 然后上传新的。

  4. Upload the content of the new wp-content folder into the old one. Overwriting the existing files, you will update the old official themes and plugins. Don’t worry, the other plugins and themes will stay the same, and your media files won’t be affected.

    将新的wp-content文件夹的内容上传到旧的文件夹中。 覆盖现有文件,您将更新旧的官方主题和插件。 不用担心,其他插件和主题将保持不变,并且您的媒体文件不会受到影响。

  5. Do the same with the files in the root directory: replace them all with the new ones by uploading all of them. The only file you need to worry about is wp-config.php but it won’t be overwritten as it does not exist in the new version: in the archives you download, wp-wonfig.php is named wp-config-sample.php. You now have to compare that file with your wp-config.php to be sure that a new line has not been added: if that is the case, copy and paste the new lines from wp-config-sample.php to your old wp-config.php.

    对根目录中的文件执行相同的操作:通过上传所有文件,将其替换为新文件。 您唯一需要担心的文件是wp-config.php但不会被覆盖,因为新版本中不存在该文件:在您下载的档案中, wp-wonfig.php被命名为wp-config-sample.php 。 现在,您必须将该文件与wp-config.php进行比较,以确保未添加新行:如果是这种情况,请将新行从wp-config-sample.php复制并粘贴到旧的wp-config.php

  6. Sometimes, an automatic update can fail and a .maintenance file gets added into your installation. If you manually update to fix the problem, you need to delete this file.

    有时,自动更新可能会失败,并且.maintenance文件会添加到您的安装中。 如果您手动更新以解决此问题,则需要删除此文件。

  7. Your database may also need to be updated. Visit your administration panel to see if that is the case: if it is, a message will appear, containing a link. Click on it, and your database will be updated.

    您的数据库可能还需要更新。 请访问您的管理面板以查看是否存在这种情况:如果是,则会出现一条包含链接的消息。 单击它,您的数据库将被更新。

  8. The update itself is finished. All you have to do now is reactivate the plugins you use.

    更新本身已完成。 现在您要做的就是重新激活您使用的插件。

更新插件和主题 (Updating Plugins and Themes)

Updating core WordPress is important, but it is also important to update the themes and plugins you use, as a bug in one of these can affect your whole installation.

更新核心WordPress很重要,但更新您使用的主题和插件也很重要,因为其中之一的错误会影响您的整个安装。

一键更新 (Updating in One Click)

Like WordPress itself, you can update plugins and themes with a one click method. To do that, go to the ‘Updates’ section of your administration panel.

与WordPress本身一样,您可以使用一键式方法更新插件和主题。 为此,请转到管理面板的“更新”部分。

If there are some plugins or themes that can be updated, they will appear here, right below the part which tells you if a new version of WordPress is available or not.

如果有一些插件或主题可以更新,它们将显示在此处,在告诉您是否有可用的新版本WordPress的部分的正下方。

To update your plugins, select them and click on the ‘Update Plugins’ button. The same can be done with themes: select them and click ‘Update Themes’.

要更新您的插件,请选择它们,然后单击“更新插件”按钮。 对于主题也可以这样做:选择主题,然后单击“更新主题”。

Update Plugins and Themes

Whether for plugins or for themes, you will be led to another page which will inform you about the progress of the update, just as it does with the WordPress update.

无论是插件还是主题,您都将被带到另一个页面,该页面将通知您更新进度,就像WordPress更新一样。

Note that for plugins, another section will also allow you to update in one click: the ‘Installed Plugins’ section in the Dashboard. If a plugin can be updated, a message will appear right below it, with a link to update it automatically. You can even select all of your plugins and chose ‘Update’ in the drop down list to bulk update the ones that need it.

请注意,对于插件,另一部分还允许您单击一次更新:仪表板中的“已安装插件”部分。 如果插件可以更新,则会在其下方显示一条消息,并带有自动更新的链接。 您甚至可以选择所有插件,然后在下拉列表中选择“更新”以批量更新需要的插件。

自动更新 (Automatic Updates)

We saw above that WordPress itself can be automatically updated, without you needing to do anything. It’s very practical and if you are a fan of automatic updates, you will be happy to know that WordPress can also automatically update your plugins and themes.

我们在上面看到了WordPress本身可以自动更新,而您无需执行任何操作。 这非常实用,如果您喜欢自动更新,您将很高兴知道WordPress也可以自动更新您的插件和主题。

Automatic updates for plugins and themes are disabled by default. To enable them, you can add a filter into the functions.php file of your theme or in a plugin, just like you can for WordPress core updates.

默认情况下,插件和主题的自动更新处于禁用状态。 要启用它们,您可以将过滤器添加到主题的functions.php文件或插件中,就像可以进行WordPress核心更新一样。

// Enable automatic updates for plugins
add_filter('auto_update_plugin', '__return_true');

// Enable automatic updates for themes
add_filter('auto_update_theme', '__return_true');

However, contrary to WordPress itself, you can’t enable automatic updates for plugins and themes with a constant in the wp-config.php file: with plugins or themes, you have no choice and you must use filters.

但是,与WordPress本身相反,您无法在wp-config.php文件中使用常量来启用插件和主题的自动更新:对于插件或主题,您别无选择,必须使用过滤器。

手动更新插件和主题 (Manually Updating Plugins and Themes)

Like WordPress, updating plugins and themes with the one click method is preferred. But you can also manually update them. In some cases, you will have no choice: for example, if a plugin is not available on WordPress.org, WordPress can not give you access to the one click method.

与WordPress一样,首选使用一键式更新插件和主题。 但是您也可以手动更新它们。 在某些情况下,您别无选择:例如,如果WordPress.org上没有插件,则WordPress无法让您访问“一键式”方法。

To manually update a plugin, begin by downloading its new version on WordPress.org or on its official web page if there is one. In most of the cases, you will get an archive, so unpack it. Then, deactivate the plugin to prevent eventual bugs.

要手动更新插件,请先从WordPress.org或官方网站上下载新版本(如果有)。 在大多数情况下,您将获得一个存档,因此请解压缩它。 然后,停用插件以防止最终的错误。

If the plugin is a single file, replace it by uploading the new one directly into the plugins subdirectory of wp-content. But most plugins are stored in a folder and, if that is the case, uploading the content of the new version into the old folder, overwriting the existing files. Then, reactivate the plugin.

如果插件是单个文件,请通过将新文件直接上载到wp-contentplugins子目录中来替换它。 但是大多数插件都存储在一个文件夹中,如果是这种情况,则将新版本的内容上载到旧文件夹中,覆盖现有文件。 然后,重新激活插件。

Manually updating a theme is similar so, as we did with plugins, begin by downloading the new version and unpack the archive.

手动更新主题与此类似,就像我们对插件所做的那样,首先下载新版本并解压缩存档。

If you currently use the theme you want to update, you should now deactivate it by activating another one. Then upload the content of the new version into the old one, replacing the old files. Now, you can reactivate this theme.

如果当前使用您要更新的主题,则现在应该通过激活另一个主题来停用它。 然后将新版本的内容上载到旧版本中,替换旧文件。 现在,您可以重新激活该主题。

一键式方法和自动更新 (A Word About the One Click Method and Automatic Updates)

WordPress cannot check if a new version is available for all the plugins and themes you use. Everyday, it checks if that is the case for the ones that are available on WordPress.org.

WordPress无法检查是否有新版本可用于您使用的所有插件和主题。 每天,它都会检查WordPress.org上是否有这种情况。

If a plugin or a theme is not on this platform, WordPress can not suggest to you the one click method, and the automatic update won’t work for this one.

如果该平台上没有插件或主题,则WordPress无法为您建议一键式方法,因此自动更新不适用于该方法。

But even if you have access to the one click or automatic update, it may not work, especially if you try to update a local installation on your computer.

但是,即使您有权单击或自动更新,也可能不起作用,尤其是当您尝试更新计算机上的本地安装时。

To be able to update WordPress, a plugin or a theme automatically, the CMS must have the right to write files. In other words, WordPress files must be owned by the web server user, or this same user must have the right to write this files.

为了能够自动更新WordPress,插件或主题,CMS必须有权写入文件。 换句话说,WordPress文件必须由Web服务器用户拥有,或者该同一用户必须有权编写此文件。

更新工具和服务 (Updating Tools and Services)

While we’re on the topic of updates, WP Updates Settings is a handy plugin that gives you an easy interface to the options discussed above, if you prefer using a plugin.

当我们处于更新主题时, WP Updates Settings是一个方便的插件,如果您喜欢使用插件,它可以使您轻松地使用上述接口。

WP Updates Settings

There are also several third party services and tools that can help you manage updates (amongst other things). ManageWP, InfiniteWP, WP Remote, MainWP and even hosting management platforms such as Plesk 12’s WordPress Toolkit have their own mechanisms to manage updates.

还有一些第三方服务和工具可以帮助您管理更新(以及其他)。 ManageWPInfiniteWPWP RemoteMainWP甚至托管管理平台(例如Plesk 12的WordPress Toolkit)都有自己的机制来管理更新。

结论 (In Conclusion)

Running the latest versions of the software you use is important. Now, you know how to do this with WordPress, its plugins and its themes.

运行您使用的软件的最新版本很重要。 现在,您知道了如何使用WordPress及其插件和主题。

As you can see, there is more than one way to update them. You should always opt for the one click and automatic methods as they are simpler, quicker and less likely to be a source of errors. However, updating manually is still an option and, sometimes, it is the only one, so it is also important to know how to do this.

如您所见,有多种方法可以更新它们。 您应该始终选择“一键式”和自动方法,因为它们更简单,更快捷,并且不太可能成为错误源。 但是,手动更新仍然是一个选项,有时甚至是唯一的选择,因此了解如何执行此操作也很重要。

Automatic updates are practical if you want to always have the latest version of WordPress, plugins and themes. It is possible to automatically update all of this so lack of time can’t be an excuse not to update!

如果您希望始终拥有最新版本的WordPress,插件和主题,则自动更新是实用的。 可以自动更新所有这些信息,因此时间不足不能成为不更新的借口!

翻译自: https://www.sitepoint.com/a-guide-to-updating-wordpress/

wordpress插件

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值