WordPress Needs WP_LOCAL for localhost
I support myself fixing Websites. I save sites on a local drive for repeat jobs. I fix most Web errors connected to localhost, before I install the fixes.
It is easy to test sites locally on Windows and Macs.
Add 127.0.0.1 domain.com
to your hosts file to set a domain to localhost. This is commonly used to block domains.
I have been using this technique for years, without any problems.
However, I was always connected to the Internet, while I worked on local sites.
Where's the Internet?
I am staying with a friend who has lousy Internet service. Service works for hours, before it slows down, and finally disconnects.
Network reconnects in 10-20 minutes. It is not helpful to call tech support, and it does not bother my friend.
WordPress crashed when I tried to debug a local site, without an Internet connection. Unplug your Internet cable to follow along on your local site.
Plugin Update Connection Error
How to crash a local WordPress site without an Internet connection:
delete from wp_options where option_name = '_site_transient_update_plugins'
- Force WordPress to check for plugin updates.
define('WP_DEBUG', true);
- Set WP_DEBUG on in wp-config.php to display the error message. Error message causes “Unexpected Output.” WordPress disables logins, because it thinks cookies are disabled.
- You can't login!
- To fix login:
define('WP_DEBUG', false);
- To fix login:
WordPress displays two error messages:
An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums. (WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.) in /wp-includes/update.php on line 295
ERROR: Cookies are blocked due to unexpected output. For help, please see this documentation or try the support forums.
You must wait three seconds for the connection error. It is not displayed:
Operation timed out after 3411 milliseconds with 0 out of 0 bytes received
WordPress for Everyone
It is important to keep WordPress and plugins updated. But it should be easy to define a variable that prevents WordPress from attempting to update itself.
Anyone with a laptop should be able to debug a WordPress site, without an Internet connection.
There are people who rely on an Internet connection at a school or library. They should be able to debug a blog at home, and upload it to a server later.
I propose adding define('WP_LOCAL', true);
WP_LOCAL
should prevent WordPress from loading external resources.
I also waited for connection failures from gravatar.com, fonts.gstatic.com, fonts.googleapis.com. I do not use Gravatars or external fonts. Were these connections from WordPress or plugins?
This is not new.
Two similar WordPress tickets were opened and closed. Timeout to WordPress API in update.php was closed 13 months ago. Increase timeout for ‘plugins/update-check’ API request was closed 7 months ago.
WordPress users know if they are connected to the Internet.
WordPress could fix the login problem, by not triggering an error to say, “Please contact your server administrator.”
I am the server administrator. I want to login and debug a WordPress site, without an Internet connection.
WordPress needs WP_LOCAL
.