WordPress常见问题及其解决方法

For many developers, WordPress is a go-to solution for both large and small jobs, however as with most things in life, it’s far from a perfect solution. Despite being a leading platform on the web, WordPress’ versatility makes it difficult to pinpoint the sources of failure when something breaks. While it’s impossible to explain every WordPress issue within this article, the guide below should help you navigate a few of the most common mistakes.

对于许多开发人员而言,WordPress是大型和小型工作的首选解决方案,但是与生活中的大多数事情一样,它远非完美的解决方案。 尽管WordPress是网络上的领先平台,但WordPress的多功能性使其很难在出现故障时查明故障的根源。 虽然不可能在本文中解释每个WordPress问题,但以下指南应可帮助您解决一些最常见的错误。

1419613624wordpress-errors

死亡白屏 (The White Screen of Death)

For the few readers who are fortunate enough to have never encountered the white screen of death, this error consists of a blank screen loading when you try to access the site in question.

对于少数幸运的有幸从未遇到死亡白屏的读者,当您尝试访问该网站时,此错误包括空白屏幕加载。

The two major causes of this error are compatibility issues from plugins and themes. If you can access your administration panel, the best way to pinpoint this error is to try deactivating all your plugins one by one, and if that doesn’t work, then try changing your theme to the default WordPress design.

导致此错误的两个主要原因是插件和主题的兼容性问题。 如果您可以访问管理面板,则查明此错误的最佳方法是尝试一次停用所有插件,如果不起作用,请尝试将主题更改为默认的WordPress设计。

第一步 (The First Steps)

If you can’t access your administration panel, you’ll have to manually deactivate the plugins and themes over FTP. After logging into your server, navigate to the plugins directory (usually wp-content/plugins) or the themes directory (wp-content/themes) and append ‘_old’ to the end of the name.

如果您无法访问管理面板,则必须通过FTP手动停用插件和主题。 登录服务器后,导航至plugins目录(通常为wp-content / plugins)或themes目录(wp-content / themes),然后在名称末尾附加“ _old”。

From there try accessing your admin panel. If you get in, you can try reactivating your plugins or themes individually until you recreate the issue. Once that happens, you’ll know the primary source of your issues.

从那里尝试访问您的管理面板。 如果您同意,则可以尝试重新激活插件或主题,直到重新创建问题为止。 一旦发生这种情况,您就会知道问题的主要根源。

进阶疑难排解 (Advanced Troubleshooting)

For more advanced troubleshooting, you can also go into your wp-config file and set the WP_DEBUG value to true (as shown below):

要进行更高级的故障排除,您还可以进入wp-config文件并将WP_DEBUG值设置为true(如下所示):

define( 'WP_DEBUG', true );

define( 'WP_DEBUG', true );

After doing this, navigate to the page with the error and you should see the details of what is causing your errors. Once you are done, be sure to disable this feature by setting the value to false (as shown below):

完成此操作后,导航至出现错误的页面,您应该看到导致错误的原因的详细信息。 完成后,请确保通过将该值设置为false来禁用此功能(如下所示):

define( 'WP_DEBUG', false );

define( 'WP_DEBUG', false );

升级后的维护模式 (Maintenance Mode after an Upgrade)

Updates are a vital part of keeping your WordPress website functional. Occasionally, however, the system doesn’t clean up all the files from the process. If you ever get the message ‘Briefly unavailable for scheduled maintenance. Please check back in a minute.’ After updating your site, then you most likely need to remove your .maintenance file manually.

更新是保持WordPress网站正常运行的重要组成部分。 但是,有时候,系统不会清除进程中的所有文件。 如果收到消息“计划维护根本无法使用。 请稍后再检查。” 更新网站后,您很可能需要手动删除.maintenance文件。

To do this, log into your website via your FTP program and delete the .maintenance file in your root folder. Your site should now work properly.

为此,请通过FTP程序登录到您的网站,然后删除根文件夹中的.maintenance文件。 您的网站现在应该可以正常工作了。

重置密码系统不起作用 (Reset Password System is not Working)

简单方法 (The Simple Method)

If you’re using the default admin user (i.e. your username is admin) you can reset your password via FTP.

如果您使用默认的管理员用户(即您的用户名是admin),则可以通过FTP重置密码。

  1. Access your site via FTP and download your active themes functions.php file通过FTP访问您的站点并下载活动主题functions.php文件
  2. At the beginning after the opening line, add the following: wp_set_password( 'password', 1 );. In this command, the 1 is the user ID, and password should be changed to your desired password.在开始行之后的开头line, add the following: wp_set_password( 'password', 1 ); 。 在此命令中,1是用户标识, 密码应更改为所需的密码。
  3. Upload this file to your site.将此文件上传到您的站点。
  4. After logging in, go back to the functions.php file and remove the code you just entered because it will otherwise reset your password every time the user logs in.登录后,返回到functions.php文件并删除刚刚输入的代码,因为否则它将在每次用户登录时重置您的密码。

复杂方法 (The Complex Method)

For those times when you lose the admin password and having a reset password link emailed to you isn’t working, you’ll need to reset your password manually. The best way to do this is to use phpMyAdmin to edit your WordPress database. You can also edit the database from the MySQL command line, but phpMyAdmin greatly simplifies the process.

对于那些丢失管理员密码并且无法通过电子邮件发送重设密码链接的情况,您需要手动重设密码。 最好的方法是使用phpMyAdmin编辑WordPress数据库。 您也可以从MySQL命令行编辑数据库,但是phpMyAdmin大大简化了该过程。

First, convert your desired password into an MD5 hash by using a hash generator. Then complete the steps below:

首先,使用哈希生成器将所需的密码转换为MD5哈希。 然后完成以下步骤:

  1. Navigate to your WordPress database导航到您的WordPress数据库
  2. Access the wp_users table访问wp_users
  3. Look for the row containing your username查找包含您的用户名的行
  4. Update the user_pass value within that row with the hash you generated before completing these steps在完成这些步骤之前,使用生成的哈希值更新该行内的user_pass
  5. Apply the changes you made应用所做的更改

内存不足 (Insufficient Memory)

On many servers, the default memory amounts allocated to WordPress isn’t sufficient to handle extensive customizations to WordPress. Fortunately, increasing your WordPrss memory limit can be done by adding the following line to your WordPress config file:

在许多服务器上,分配给WordPress的默认内存量不足以处理WordPress的大量自定义设置。 幸运的是,可以通过将以下行添加到WordPress配置文件中来增加WordPrss内存限制:

define( 'WP_MEMORY_LIMIT', '64M' );

define( 'WP_MEMORY_LIMIT', '64M' );

The above command sets the WordPress memory limit to 64M. If you need a higher or lower limit, replace that value with the desired amount.

上面的命令将WordPress内存限制设置为64M。 如果需要更高或更低的限制,请将该值替换为所需的数量。

主动保护自己的方法 (A Proactive Way to Protect Yourself)

In a worst case scenario the best solution to resolving difficult WordPress errors is to roll back to an older backup that you have on hand. One of the ways to streamline this process is to explore your managed WordPress hosting options. If you choose to handle all site maintenance yourself, then you should ensure that you at least have a rolling cycle of daily, monthly and weekly backups.

在最坏的情况下,解决困难的WordPress错误的最佳解决方案是回滚到您手头的旧备份。 简化此过程的方法之一是探索托管的WordPress托管选项 。 如果选择自己处理所有站点维护,则应确保至少具有每日,每月和每周备份的滚动周期。

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注