当您被锁定WordPress管理员(wp-admin)时该怎么办

皇甫智明
2023-12-01

This past weekend, we had a user who was locked out of WordPress Admin panel of their site. While we had written numerous articles covering each specific issue, we realized that we should combine all of them at one place to make it easier for others. In this article, we will show you what to do when you are locked out of WordPress Admin (wp-admin), so you can regain access to your site.

在过去的一个周末,我们有一个用户被锁定在其站点的WordPress管理面板之外。 尽管我们针对每个特定问题撰写了许多文章,但我们意识到我们应该将所有这些文章集中在一个地方,以使其他地方更容易使用。 在本文中,我们将向您展示当您被WordPress Admin(wp-admin)锁定时该怎么办,以便您可以重新获得对网站的访问权限。

There are few reasons why you could be locked out of WordPress admin, so let’s take a look at each of them one by one. Hopefully through this process of elimination, you will be able to figure out the solution for your problem.

有几种原因使您无法与WordPress管理员保持联系,因此让我们逐一查看它们。 希望通过此消除过程,您将能够找出问题的解决方案。

建立数据库连接时出错 (Error Establishing Database Connection)

Are you seeing this error on your entire site? The reason why you get this error is because WordPress is unable to establish a database connection. This could happen for various reasons. It could happen if your database got corrupted for some reason. It could happen if your web hosting server is having some issues. If this is your issue, then please refer to our guide on how to fix the error establishing database connection in WordPress.

您是否在整个网站上看到此错误? 出现此错误的原因是因为WordPress无法建立数据库连接。 这可能由于各种原因而发生。 如果您的数据库由于某种原因而损坏,则可能会发生这种情况。 如果您的网络托管服务器出现问题,则可能会发生。 如果这是您的问题,请参考我们的指南, 了解如何解决在WordPress中建立数据库连接的错误

死亡白屏 (White Screen of Death)

Are you seeing a white screen on your WordPress admin? This issue is often referred to as the WordPress white screen of death. It usually happen because you exhausted the memory limit. It could be caused by a poorly coded plugin or theme. It could also be caused by unreliable web hosting. If you are seeing this error, then please refer to our guide on how to Fix the WordPress white screen of death.

您是否在WordPress管理员上看到白屏? 此问题通常被称为WordPress死亡白屏。 通常是因为耗尽了内存限制。 这可能是由插件或主题编码不正确引起的。 它也可能是由不可靠的网络托管引起的。 如果您看到此错误,请参阅有关如何修复WordPress白屏死机的指南

错误的密码问题 (Incorrect Password Issue)

Sometimes, even when you are typing the correct username and password combination, you won’t be able to login. When you try to reset your password, you never receive the email. This can happen if you were a victim of a hack. We would recommend that you reset your WordPress password from phpMyAdmin.

有时,即使您输入正确的用户名和密码组合,也将无法登录。 当您尝试重设密码时,您永远不会收到电子邮件。 如果您是黑客的受害者,则可能会发生这种情况。 我们建议您从phpMyAdmin重置WordPress密码

This method can be a bit overwhelming for new users, but this is your best bet.

对于新用户来说,此方法可能有点不知所措,但这是您最好的选择。

丢失的管理员权限 (Lost Admin Privileges)

Sometimes, you may be able to login to your WordPress admin, but you don’t see any of the admin functionality. For example, no plugins, no themes etc. This could happen if your user permissions were modified. Often this happen due to a hack. Hackers would infect your site, and then delete your admin privileges. In this case, you should add an admin user to the WordPress database via MySQL (phpMyAdmin).

有时,您也许可以登录WordPress管理员,但是看不到任何管理员功能。 例如,没有插件,没有主题等。如果修改了用户权限,则可能会发生这种情况。 通常,这种情况是由于黑客入侵而发生的。 黑客会感染您的网站,然后删除您的管理员权限。 在这种情况下,您应该通过MySQL(phpMyAdmin)将admin用户添加到WordPress数据库

PHP错误(即语法错误,意外函数等) (PHP Errors (i.e Syntax error, unexpected function etc))

These PHP errors usually happen when you are pasting the code from a website. Often beginners use the built-in WordPress editor from their dashboard. While that feature is pretty handy, but if you don’t know what you are doing, then it can be a disaster. If you pasted a code from a website which locked you out of your WordPress admin, then the first thing you need to do is take a deep breath. Now the only way to fix this issue is using a FTP program (How to use FTP). Once you have installed the FTP program, login to your site. Go to the theme file that you modified. Most likely it was the functions.php file. Now get rid of the code that you added in there. Re-upload the file, and you should be good to go.

当您从网站粘贴代码时,通常会发生这些PHP错误。 通常,初学者从其仪表板使用内置的WordPress编辑器。 虽然该功能非常方便,但是如果您不知道自己在做什么,那将是一场灾难。 如果您从某个网站粘贴了代码,从而将您锁定在WordPress管理员之外,那么您要做的第一件事就是深呼吸。 现在,解决此问题的唯一方法是使用FTP程序( How to use FTP )。 安装FTP程序后,登录到您的站点。 转到您修改的主题文件。 最有可能的是functions.php文件。 现在摆脱在其中添加的代码。 重新上传文件,您应该一切顺利。

Before you go on the site and comment “this code broke my website”, please refer to our beginner’s guide to pasting snippets from the web into WordPress. This is just to prevent you from looking like a fool on the web. Often its hard to admit that the mistake might be yours, so make sure of that first before you point the finger at someone else.

在您访问网站并评论“此代码破坏了我的网站”之前,请参阅我们的初学者指南,以将网络中的摘要粘贴到WordPress中 。 这只是为了防止您看起来像个傻瓜。 通常很难承认该错误可能是您的错误,因此在将手指指向其他人之前,请先确定该错误。

Hopefully after going through all of these possible scenarios, you have already fixed your site. If one of these solutions helped fix your issue, then please let us know in the comments. If you have a solution that is not mentioned in this article, then please share it in the comments as well.

希望在经历所有这些可能的情况之后,您已经修复了网站。 如果这些解决方案之一有助于解决您的问题,请在评论中告知我们。 如果您有本文未提及的解决方案,则也请在评论中分享它。

翻译自: https://www.wpbeginner.com/wp-tutorials/locked-out-of-wordpress-admin/

 类似资料: