Ko darīt, ja esat bloķēts no WordPress admin (wp-admin)

Being locked out of the WordPress admin area (wp-admin) can be frustrating and happens for various reasons, including plugin or theme issues, incorrect password attempts, or changes to user permissions. Here’s a comprehensive guide on what to do if you find yourself locked out of WordPress admin:

Clear Your Browser Cookies and Cache

Sometimes, the issue might be as simple as a browser problem. Clear your browser’s cookies and cache to ensure it’s not a session glitch preventing you from logging in.

Disable Plugins

A faulty plugin can cause lockouts, especially if it manages security or user roles.

  • Via FTP or File Manager: Connect to your site using an FTP client or the file manager in your hosting control panel. Navigate to the wp-content folder and find the spraudņi folder. Rename it to something like plugins_deactivate to disable all plugins. If this resolves the issue, rename the folder back to spraudņi and then disable plugins one by one in the WordPress admin to find the culprit.

Reset Your Password

If the issue is password-related, try resetting it.

  • Via Email: Use the “Lost your password?” link on the login page to reset your password via email.
  • Via phpMyAdmin: If email reset doesn’t work, you can reset your password directly in the database. Access phpMyAdmin from your hosting dashboard, find your WordPress database, and browse the wp_users table. Edit the user entry, enter a new value in the user_pass field, select MD5 in the functions menu, and save changes.

Check User Permissions

If you suspect your user roles or permissions have been altered:

  • Via phpMyAdmin: Access the wp_usermeta table in your WordPress database. Check the wp_capabilities (the table prefix wp_ might be different) for your user ID to ensure it’s set to a:1:{s:13:"administrator";s:1:"1";}. This string designates you as an administrator.

Verify Your wp-config.php File

Ensure that your wp-config.php file hasn’t been altered, especially the AUTH_KEY and other security keys, as this could affect logins.

  • Via FTP or File Manager: Download and inspect your wp-config.php file. Look for any anomalies or recent changes you didn’t make, especially around the WordPress security keys.

Deactivate .htaccess File

Misconfigurations in your .htaccess file can prevent access to the admin area.

  • Via FTP or File Manager: Pārdēvējiet savu .htaccess failu uz kaut ko līdzīgu .htaccess_old lai to deaktivizētu. Ja tas ļauj piekļūt, reģenerējiet jaunu .htaccess failu, dodoties uz Iestatījumi > Permalinks WordPress admin un noklikšķinot uz "Saglabāt izmaiņas".

Check for IP Deny Rules

Ja jūsu IP ir nejauši pievienots aizliegumu sarakstam jūsu hostinga vidē vai ar drošības spraudņa palīdzību, piekļuve wp-admin var tikt bloķēta.

  • Izmantojot paneli cPanel vai hostinga vadības paneli: Meklējiet "IP Deny Manager" vai līdzīgas iespējas hostinga vadības panelī. Pārliecinieties, ka jūsu IP nav iekļauts sarakstā.
  • Izmantojot drošības spraudņus: Ja jums ir piekļuve vietnes failiem, iespējams, būs nepieciešams manuāli rediģēt spraudņu failus, kas kontrolē IP piekļuvi, lai noņemtu visus nolieguma noteikumus, kas ietekmē jūsu IP.

Sazinieties ar hostinga pakalpojumu sniedzēju

Ja neviens no iepriekš minētajiem soļiem nedarbojas, sazinieties ar hostinga pakalpojumu sniedzēju. Viņi var pārbaudīt, vai servera pusē nav problēmu, palīdzēt noteikt bloķēšanas iemeslu un, iespējams, varēs atjaunot piekļuvi.

Restore From a Backup

Ja jums ir nesen veikta vietnes dublējuma kopija, kā pēdējais līdzeklis var palīdzēt tās atjaunošana, jo īpaši, ja bloķēšanas iemesls ir nesen veiktas izmaiņas vai atjauninājums.

Saskaroties ar bloķēšanas problēmu, galvenais ir pacietība un sistemātiska problēmu novēršana. Vienmēr veiciet profilaktiskus pasākumus, piemēram, regulāri dublējiet dublējumkopijas un piesardzīgi atjauniniet spraudņus/temas atjauninājumus, lai nākotnē samazinātu šādu problēmu skaitu.