Local WordPress administration

localhost/wordpress/wp-admin

The correct admin URL depends on the local site’s host, port, and install directory. http://localhost/wordpress/wp-admin/ is only right when the web server uses the default HTTP port and WordPress lives under a wordpress path.

WordPress local developmentXAMPP · MAMP · Local · Docker · custom stacksUpdated September 5, 2026
Admin path/wp-admin/
Login path/wp-login.php
Host and portStack-specific
Before recoveryBack up

Build the URL from the working site

First open the local site’s home page, then append /wp-admin/ to the exact base URL:

Local siteAdmin URL
http://localhost/wordpress/http://localhost/wordpress/wp-admin/
http://localhost:8080/wordpress/http://localhost:8080/wordpress/wp-admin/
http://mysite.local/http://mysite.local/wp-admin/
http://127.0.0.1:8888/shop/http://127.0.0.1:8888/shop/wp-admin/

If the home page does not open, solve the web-server, port, database, or container problem first. WordPress login changes cannot fix a refused TCP connection.

Match the symptom

SymptomLikely layerNext check
Connection refusedWeb server is stopped or the port is wrong.Start the local stack and use its displayed URL.
Server 404The WordPress directory or virtual host is different.Find the working site root; confirm the install path.
Redirects to another domain or portWordPress Address / Site Address does not match the local URL.Inspect the redirect target and local database/config overrides.
“Error establishing a database connection”PHP reached WordPress, but database settings or service failed.Check the database service and DB_HOST, name, user, and password in wp-config.php.
Blank page or PHP fatal errorPlugin, theme, PHP version, or code failure.Enable log-only WordPress debugging on the local copy.
Login form loops backCookies, mismatched site URL, HTTPS/proxy headers, or plugin behavior.Check the final URL, browser cookies for the local origin, and PHP/web logs.

Recover a lost password

Use the least invasive method available:

  1. Use Lost your password? when the local environment sends or captures mail.
  2. If WP-CLI is installed for the project, list users and update the intended account with the documented wp user command.
  3. Use WordPress’s official database or emergency recovery procedures only after backing up the local database and confirming its table prefix.

Do not assume the user ID is 1 or the table is named wp_users. Prefixes and account IDs vary. A direct database edit against the wrong row is destructive.

Log a white screen safely

On a local or staging copy, add these settings before the “stop editing” line in wp-config.php:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

Reload once, then inspect wp-content/debug.log and the PHP/web-server logs. Turn debugging off after the diagnosis. WordPress advises taking a backup before modifications and does not recommend these debug tools for a live site.

Fix a wrong local redirect

  1. Record the exact Location target with curl -I or browser DevTools.
  2. Check whether WP_HOME or WP_SITEURL is defined in wp-config.php.
  3. Otherwise verify the WordPress Address and Site Address values in the database using a supported tool.
  4. Keep scheme, hostname, port, and subdirectory consistent with the local stack.

A serialized-data search-and-replace should use WP-CLI or another WordPress-aware tool; a blind SQL text replacement can corrupt serialized values.

Official references