Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitcheswp-config.php is the PHP file WordPress loads before the normal bootstrap. It stores database connection details and can define constants that change the site’s URLs, debugging behavior, memory requests, filesystem paths, caching bootstrap, and authentication secrets.
Antihost offers managed WordPress hosting with free migration, one-click staging and a 14-day free trial.
The most important rule is placement: add custom constants before the line usually marked /* That's all, stop editing! Happy blogging. */. WordPress core establishes defaults during startup, but many values are defined only when your configuration has not already defined them.
As an Amazon Associate I earn from qualifying purchases.
What wp-config.php does
WordPress reads wp-config.php before loading themes, plugins, and the rest of core. The file normally contains the database name, user, password, host, character set, collation, and the $table_prefix used for WordPress tables. It also contains authentication keys and salts and may define constants that alter how WordPress runs.
Constants are PHP values that are set once with define(). WordPress’s wp_initial_constants() function supplies defaults for many settings, but it does not replace a value that has already been defined in wp-config.php. That is why the same constant can change behavior without editing core files.
#1 Best Overall
Where to place custom constants
Put definitions above the editing marker, before WordPress finishes loading configuration:
define( 'WP_DEBUG', true );
/* That's all, stop editing! Happy blogging. */
Definitions placed after that marker may be too late for the code that needs them. Keep the file valid PHP: use straight quotes, semicolons, and no whitespace or output before the opening <?php tag.
Recommended Free Tools
URL constants: WP_HOME versus WP_SITEURL
These constants solve different URL problems. WP_HOME is the public address visitors use. WP_SITEURL is the address where the WordPress application files live. They are often identical, but they can differ when WordPress core is installed in a subdirectory or when a reverse proxy separates the public site from the application path.
| Constant | Controls | Typical value |
|---|---|---|
WP_HOME |
Public site address shown to visitors | https://example.com |
WP_SITEURL |
URL used to reach WordPress core files | https://example.com/wp |
A subdirectory installation can use:
define( 'WP_HOME', 'https://example.com' );
define( 'WP_SITEURL', 'https://example.com/wp' );
At runtime, these values override the corresponding settings stored in the wp_options table. They do not rewrite those database rows. If you remove the constants later, WordPress can revert to the database values, which may explain an unexpected URL change during a migration.
When either constant is defined, WordPress displays that value on the General Settings screen and prevents editing the related field in the dashboard. This is intentional: the configuration file, not the settings page, becomes authoritative.
Rank #2
URL mistakes and recovery
Use the exact scheme, host, and path that the site should serve. A wrong scheme can create HTTP-to-HTTPS redirects that never settle; a wrong host can redirect visitors to another domain; and a missing subdirectory can break CSS, JavaScript, images, login links, or REST requests.
- Confirm the public address and the actual location of the WordPress installation.
- Set
WP_HOMEto the public address andWP_SITEURLto the application address. - Clear browser and proxy caches, then test the front page, login page, dashboard, media URLs, and a REST API request.
- If the site becomes inaccessible, edit
wp-config.phpthrough hosting file access or SSH and correct or temporarily remove the definitions.
Debugging constants and safe error reporting
WP_DEBUG enables WordPress debug mode. It is intended primarily for development and staging copies, where notices, warnings, deprecated-code messages, and PHP errors can be investigated without exposing them to visitors.
Logging and display are separate controls. A practical development or staging configuration is:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
define( 'SCRIPT_DEBUG', true );
| Constant | Effect |
|---|---|
WP_DEBUG |
Turns on WordPress debug mode. |
WP_DEBUG_LOG |
Writes errors to wp-content/debug.log when debugging is enabled. |
WP_DEBUG_DISPLAY |
Controls whether notices and warnings are rendered in page output. |
SCRIPT_DEBUG |
Loads non-minified core JavaScript and CSS for development. |
A reliable debugging workflow
- Back up the site and reproduce the problem on a local or staging copy whenever possible.
- Enable
WP_DEBUGandWP_DEBUG_LOG, while keepingWP_DEBUG_DISPLAYfalse. - Reproduce the failing request, then inspect
wp-content/debug.log. - Use the timestamp, file path, function name, plugin or theme name, and stack information to identify the first relevant error.
- Disable or update the offending extension, correct the code, or restore a known-good version.
- After testing, restore production settings so debug output is not exposed and unnecessary logging does not continue.
Displaying errors on a public site can reveal filesystem paths, database details, plugin names, or other information useful to an attacker. A production site can log a fault while returning a normal page to visitors.
Memory limits: WP_MEMORY_LIMIT and WP_MAX_MEMORY_LIMIT
These constants request different amounts of PHP memory for different workloads. WP_MEMORY_LIMIT applies to front-end requests. WP_MAX_MEMORY_LIMIT is the higher limit used for administration and intensive operations such as updates, imports, and image processing.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minute| Constant or scope | Documented value | When it applies |
|---|---|---|
Single-site WP_MEMORY_LIMIT |
40M | Front-end requests on a single-site installation, under current WordPress Hosting Handbook guidance. |
Multisite WP_MEMORY_LIMIT |
64M | Front-end requests on multisite, under the same guidance. |
WP_MAX_MEMORY_LIMIT |
256M | Administration and intensive tasks when PHP permits a runtime change and the existing limit is not already higher or unlimited. |
To request larger values, add:
define( 'WP_MEMORY_LIMIT', '128M' );
define( 'WP_MAX_MEMORY_LIMIT', '256M' );
The word “request” matters. These constants cannot defeat a host-level php.ini memory_limit, a managed platform policy, or a server that blocks ini_set(). If PHP refuses runtime changes, the server’s effective ceiling remains in force. A fatal error can therefore continue even after the constants have been increased.
Why more memory may not fix a fatal error
A memory exhaustion message can be a symptom rather than the root cause. A plugin may create an unbounded query, a theme may recurse, an import may contain malformed data, or an image operation may require more resources than the server can provide. Raising the limit can hide the symptom temporarily while leaving the defect in place.
- Check the PHP error log and
wp-content/debug.logfor the file and operation that exhausted memory. - Test with recently added or updated plugins and the active theme disabled on staging.
- Break large imports into smaller batches and resize unusually large images.
- Ask the host what
memory_limitis actually active and whether runtime changes are permitted. - Increase a limit only when the workload is understood and the server has sufficient physical memory.
What WP_CACHE actually does
WP_CACHE is a bootstrap signal, not a complete caching system. When it is true, WordPress attempts to load wp-content/advanced-cache.php early in the request. Defining the constant by itself does not install a cache, create that drop-in, or configure expiration and purge rules.
If advanced-cache.php is absent, WP_CACHE generally has little or no effect. A page-cache plugin or hosting platform normally creates and manages the drop-in. Removing a caching plugin can leave the file behind, so check the wp-content directory when behavior persists after an uninstall.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Page cache versus object cache
| Layer | Drop-in | Purpose |
|---|---|---|
| Page-cache bootstrap | advanced-cache.php |
Serves or prepares cached page responses early in WordPress loading. |
| Persistent object cache | object-cache.php |
Stores database query results and other objects in a persistent backend. |
Persistent object caching through object-cache.php is separate from WP_CACHE and may work without it. Redis- or Memcached-based integrations therefore have different installation files and controls from full-page caching. Do not assume that seeing WP_CACHE means every caching layer is active.
Rank #4
Authentication keys and salts
The standard configuration includes authentication keys and salts. They strengthen cookies and other authentication data by ensuring that captured or forged values are difficult to reuse. Treat them like passwords: keep them private, do not commit them to a public repository, and do not paste them into support forums.
If compromise is suspected, rotating the values invalidates existing login cookies, which logs users out and forces fresh authentication. WP-CLI provides the documented command:
wp config shuffle-salts
Run it from the WordPress installation directory with appropriate filesystem permissions, then verify that administrators can sign in again. Database credentials in the same file deserve the same secrecy and should be changed through the host or database administrator when exposed.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Other constants and paths worth knowing
WP_CONTENT_DIR
WP_CONTENT_DIR defines the absolute filesystem path to the wp-content directory. It is a server path, not a browser URL. A wrong value can make WordPress report missing plugins, themes, uploads, or language files even when those files exist elsewhere.
SCRIPT_DEBUG
SCRIPT_DEBUG is useful when a minified core asset obscures a JavaScript or CSS problem. Non-minified files are easier to inspect, but they are not a performance setting for production. Enable it while diagnosing, then return to normal production values.
Database constants and $table_prefix
The database constants tell WordPress how to connect to MySQL-compatible storage. The $table_prefix value determines the prefix used for tables such as wp_options and wp_posts. If the prefix is changed without renaming tables or updating the configuration consistently, WordPress may appear to have no content because it is looking at a different table set.
Production-safe configuration checklist
- Keep database credentials, salts, and keys outside public repositories and backups shared with untrusted parties.
- Define custom constants before the editing marker.
- Use
WP_HOMEandWP_SITEURLonly when their exact runtime values are known. - On public production pages, keep
WP_DEBUG_DISPLAYdisabled. - Use
WP_DEBUG_LOGselectively and remove or rotate logs that contain sensitive data. - Confirm the host’s effective PHP
memory_limitbefore assuming a WordPress memory constant took effect. - Inspect both
advanced-cache.phpandobject-cache.phpwhen diagnosing caching behavior. - Rotate salts after suspected exposure and expect all users to be logged out.
- Back up
wp-config.phpsecurely before editing it.
Common questions
Can I edit these settings in the dashboard?
Not when the corresponding constant is defined. WordPress shows the configured URL but locks that field because the value comes from wp-config.php.
Does WP_CACHE install caching?
No. It only tells WordPress to try loading wp-content/advanced-cache.php; a cache system must provide and configure that drop-in.
Why does the memory increase have no effect?
The host may block runtime changes or enforce a lower server-level PHP limit. The underlying plugin, theme, import, or image-processing fault may also be consuming excessive memory.
Should debugging be enabled on a live site?
Use debugging on local or staging copies whenever possible. If production diagnosis is unavoidable, log errors while keeping display disabled, reproduce the fault briefly, inspect the log, and restore normal settings.
The Bottom Line
wp-config.php is the control point WordPress reads before startup. Define constants above the editing marker, distinguish public URLs from application URLs, separate logged errors from displayed errors, treat memory values as requests rather than guarantees, and remember that WP_CACHE needs a drop-in. Protect the file’s credentials and salts as carefully as any other production secret.
Free tools Windows power users keep installed
One-click scans. No signup required.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




