Skip to main content
GrN.dk

Main navigation

  • Articles
  • Cases
  • Contact
  • Your Digital Project Manager
  • About Greg Nowak
  • Services
  • Portfolio
  • Container
    • Excel Freelancer
    • Kubuntu - tips and tricks
    • Linux Apache MySQL and PHP
    • News
    • Image Gallery
User account menu
  • Log in

Breadcrumb

  1. Home

WordPress Admin Lockout: A Safe Recovery Guide

By Greg Nowak. Last updated 2026-07-16.

A WordPress admin lockout rarely calls for a clever hack. It calls for a controlled recovery. The account may belong to a former employee, its recovery email may be inaccessible, or a plugin failure may have taken the login screen down. Whatever the cause, the business priority is the same: restore the right person’s access without damaging the live site, creating an undocumented administrator, or weakening security.

Work from the least invasive option to the most invasive: use the normal password reset when possible, prefer WP-CLI when you have shell access, and edit the database only when it is genuinely the last route in. Before changing anything, take a database backup or hosting snapshot and confirm that you are working on production—not a similarly named staging site.

Choose the narrowest recovery route

Situation Best first action Reason
The account email still works Use “Lost your password?” WordPress completes the reset through its normal workflow.
You have shell access Use WP-CLI The update goes through WordPress rather than bypassing it.
Only the recovery email is wrong Update the email, then use the normal reset This avoids changing the password unnecessarily.
Only database access remains Make one targeted SQL change A narrow change is easier to verify and reverse.
A sensible escalation path for recovering access to a live WordPress site.

Use WP-CLI when shell access is available

WP-CLI is usually the cleanest operational route because WordPress performs the user update. Start by identifying the correct administrator. Do not assume user ID 1 belongs to the current owner.

wp user list --role=administrator \
  --fields=ID,user_login,user_email \
  --format=table

If the email address is obsolete, update it first. That may be enough to restore the standard password-reset process:

wp user update 42 \
  [email protected] \
  --skip-email

If a password change is still necessary, let WordPress store it through its current password-handling system:

wp user update 42 \
  --user_pass='A-new-long-unique-password'

Treat that password as a placeholder, not something to copy literally. Command arguments may be retained in shell history or exposed by server logging, so use an approved secure-input or secret-management method when the environment provides one. Keeping the notification email enabled for a password change can also provide a useful security signal to the account owner.

On multisite or multidomain installations, target the intended site with --url=https://example.com. The user-list command supports --network when a network-wide inventory is required. If broken site code prevents WP-CLI from loading, try the global --skip-plugins and --skip-themes flags. Must-use plugins still load, so these flags do not isolate every extension.

Use SQL only when it is the remaining door

Direct database work bypasses normal application controls and cache handling. Confirm the database, table prefix, and intended user before editing. Many installations do not use the default wp_ prefix.

SELECT ID, user_login, user_email
FROM yourprefix_users
ORDER BY ID;

If the problem is simply an unreachable email account, check that the new address is not already assigned to another user. Then make that single change and use the normal password-reset flow:

UPDATE yourprefix_users
SET user_email = '[email protected]'
WHERE ID = 42;

Verify the affected row immediately. If the change does not appear in WordPress, a persistent object cache may need to be cleared through the hosting platform. Do not alter roles or capabilities unless you have established that authorization—not authentication—is the actual problem.

MD5 is an emergency bridge, not the recovered state

Older WordPress recovery instructions commonly recommend writing an MD5 value into user_pass. WordPress retains compatibility with legacy hashes, but since WordPress 6.8 it uses bcrypt-based password hashing by default. An MD5 database update should therefore be reserved for a situation where no safer recovery route is available.

UPDATE yourprefix_users
SET user_pass = MD5('temporary-unique-password')
WHERE ID = 42;

If you must use this fallback, log in and promptly set another new, unique password through wp-admin or WP-CLI. That sends the password through WordPress’s current hashing path and replaces the temporary credential, which may remain in database-client history or operational logs. Never reuse it on another service.

Close the incident properly

Regaining access is only half the job. A professional recovery leaves ownership clearer than it was before the lockout.

  • Confirm that the account belongs to a named person or accountable business role.
  • Remove emergency administrators and other temporary credentials.
  • Review all current administrators and remove access that is no longer required.
  • Store recovery details in the team’s approved password manager, not email or chat.
  • Document the production host, account owner, recovery email, and handover contact.
  • Test the normal password-reset route after the incident.

If the lockout was unexplained—or you discover an unfamiliar administrator—treat it as a possible security incident rather than a simple password problem. Preserve relevant logs and review hosting, SFTP, deployment, database, and WordPress access before declaring the matter closed.

Keep integrations separate from human logins

Scripts, reporting tools, and external services should not share a person’s administrator password. WordPress Application Passwords provide individually revocable credentials for API access over HTTPS. Create one descriptive credential per integration and revoke it when the tool or supplier is retired. Application Passwords are for programmatic access; they cannot be used for an interactive wp-admin login.

Most repeat lockouts come from unclear ownership rather than WordPress itself. Add access review to employee and agency offboarding, maintain accountable recovery contacts, and include credentials in every website handover. If access ownership or emergency procedures have become muddled, Greg can help you regain control and establish a process your team can maintain.

Related on GrN.dk

  • Debug WordPress Safely on a Live Site
  • WordPress Security Releases Still Need an Ops Runbook for Business Sites
  • AI disclosure rules belong in the CMS, not a spreadsheet

Need help with this kind of work?

Improve your WordPress access process Get in touch with Greg.

Sources

  • wp user list – WP-CLI Command
  • wp user update – WP-CLI Command
  • Reset your password – WordPress.org Documentation
  • wp_check_password() – WordPress Developer Resources
  • Application Passwords – WordPress Advanced Administration Handbook
Last modified
2026-07-16

Tags

  • wordpress
  • WP-CLI
  • Website Operations
  • security
  • admin access

Review Greg on Google

Greg Nowak Google Reviews

 

Illustrated infographic summarizing: One Timeout, Two Orders: Make AI Actions Safe to Retry
One Timeout, Two Orders: Make AI Actions Safe to Retry
2026-07-25

A timed-out AI action may already have succeeded. Stable keys, durable ledgers, queues and stored results prevent a routine retry from duplicating real work.

Illustrated infographic summarizing: Your AI Visibility Dashboard Needs a Methodology, Not More Charts
Your AI Visibility Dashboard Needs a Methodology, Not More Charts
2026-07-24

A practical framework for measuring AI-search visibility with fixed prompts, repeated tests, separate metrics, retained evidence, and honest reporting.

Illustrated infographic summarizing: AI Admin APIs Are Here—But Your Directory Is Still the Source of Truth
AI Admin APIs Are Here—But Your Directory Is Still the Source of Truth
2026-07-23

New AI admin APIs can automate access and spend controls, but reliable governance still starts with authoritative directory data and clear ownership.

Illustrated infographic summarizing: OpenAI Presence Arrived—But Is Your Workflow Ready for an Agent?
OpenAI Presence Arrived—But Is Your Workflow Ready for an Agent?
2026-07-22

Before an AI agent can take on real work, its workflow needs clear scope, permissions, handoffs, evaluation cases, and production monitoring.

Illustrated infographic summarizing: Chatbot Transcripts Quietly Became a Retention and Redaction Problem
Chatbot Transcripts Quietly Became a Retention and Redaction Problem
2026-07-21

Chatbot transcripts spread across providers, logs and support tools. Here is how to map each copy, redact sensitive data and test deletion properly.

Illustrated infographic summarizing: Cloudflare Service Keys Stop in September: Find Every Caller
Cloudflare Service Keys Stop in September: Find Every Caller
2026-07-20

Cloudflare Service Keys stop working on September 30, 2026. Here is how to find every caller, move to scoped API tokens and avoid a late outage.

Illustrated infographic summarizing: Your AI Workflow Needs an Acceptance Test Before It Meets Customers
Your AI Workflow Needs an Acceptance Test Before It Meets Customers
2026-07-19

A practical way to test AI workflows using realistic scenarios, tool checks, human rubrics, regression suites, and clear release gates.

Three cover candidates for The Goats Were Load-Bearing fanned on a dark background: an ember-lit door, three slow knocks, and a founders' ledger
The Goats Were Load-Bearing: a fantasy where the bill always comes due
2026-07-19

A teaser for the upcoming darkly comic fantasy novel The Goats Were Load-Bearing — a village, a door that must stay poor, and the worst possible time to sell the herd. Readers pick the cover.

Vegan Power game: the yellow player catches falling fruit while a chicken and a cow look on
Vegan Power: The Little Game About Eating Fruit, Not Friends
2026-07-19

Vegan Power is a free browser game where you catch fruit, dodge the animals, protect seven hearts, and chase a better high score.

KotobaMon title screen: the Japanese logo コトバモン over a low-poly 3D island with monsters, cherry-blossom trees and a trainer.
KotobaMon: Shipping a 3D Browser Game With No Build Step and Self-Hosted Voice
2026-07-19

A look at fantasy.grn.dk, a browser-based 3D game that teaches Japanese with no build step, procedural art and self-hosted AI voice, and what its constraints show about shipping interactive products fast and cheap.

More articles
RSS feed

GrN.dk web platforms, web optimization, data analysis, data handling and logistics.