Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk8 min

WordPress wp-config.php PHP Constants Explained

A practical guide to WordPress wp-config.php constants, including URL overrides, safe debugging, PHP memory ceilings, cache drop-ins, salts and troubleshooting.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

wp-config.php is the PHP file WordPress loads before it starts its 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.

Constants must be declared before the file’s /* That's all, stop editing! Happy blogging. */ marker. WordPress core establishes defaults only when a value has not already been defined, so a correctly placed definition takes effect early enough to control startup.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What wp-config.php controls

A standard installation uses wp-config.php for the database name, user, password, host, table prefix and authentication keys. It is also the site’s main environment switchboard. A constant is a PHP value that WordPress reads throughout a request; unlike a dashboard option, it is normally changed by editing the file or by deployment tooling.

Because the file runs before WordPress finishes loading, a single incorrect value can affect every page. A malformed URL can cause redirect loops, a visible debug notice can disclose server paths, and an unavailable memory setting can leave an administrator believing a fix worked when PHP is still enforcing a lower limit.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

Where to put custom definitions

Open the active wp-config.php in the site’s document root (or the location used by your host). Add custom define() statements above the editing marker:

/* Custom settings go above this line. */
define( 'WP_DEBUG', true );

/* That's all, stop editing! Happy blogging. */

Back up the file before editing, preserve its PHP syntax, and test the site immediately after saving. A missing semicolon or an unmatched quote can produce a “critical error” before WordPress can render its own recovery screen.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

URL constants: WP_HOME versus WP_SITEURL

These two constants solve different URL problems:

Constant Controls Typical value Dashboard effect
WP_HOME The public address visitors use for the site https://example.com The corresponding General Settings field is shown but cannot be edited
WP_SITEURL The address where the WordPress application files are located https://example.com/wp The WordPress Address field is shown but cannot be edited

WordPress uses these values at runtime instead of the matching values stored in the wp_options table. Defining a constant does not rewrite those database rows. Remove the definitions later and the database values become relevant again.

Subdirectory installation example

If WordPress core is installed in /wp while the public site remains at the domain root, use:

define( 'WP_HOME', 'https://example.com' );
define( 'WP_SITEURL', 'https://example.com/wp' );

This arrangement is useful after a migration, behind a reverse proxy, or whenever the public URL and application URL differ. Both values must use the correct scheme (http versus https), hostname, port and path. A typo can send visitors between two URLs indefinitely, generate mixed-content warnings, or point CSS and JavaScript requests at the wrong directory.

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

Recovering from a bad URL

  1. Use file manager, SFTP or SSH to open wp-config.php.
  2. Check for duplicate WP_HOME or WP_SITEURL definitions; the first effective definition should be the intended one.
  3. Set both values to the exact canonical URLs, including any subdirectory and without a trailing slash.
  4. Clear browser, proxy and page-cache entries, then test the front end and /wp-admin/.
  5. Once the site is stable, decide whether the constants should remain as deliberate deployment settings or be removed so the dashboard/database values control the URLs.

Debugging constants and safe error visibility

WP_DEBUG enables WordPress debug mode. It is intended primarily for development and staging copies, where notices, deprecated calls and warnings can be investigated without exposing them to visitors.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Logging and displaying errors are separate controls. A practical development or staging block is:

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

What each setting does

Constant Purpose Recommended handling
WP_DEBUG Turns on WordPress debug mode Use on local or staging environments while reproducing a fault
WP_DEBUG_LOG Writes errors to wp-content/debug.log Keep enabled while collecting a reproducible error; protect the log from public access
WP_DEBUG_DISPLAY Controls whether notices and warnings appear in generated HTML Set to false on any public site
SCRIPT_DEBUG Loads non-minified WordPress JavaScript and CSS Enable when tracing an asset or JavaScript problem; disable for normal production operation

A disciplined debugging workflow

  1. Take a backup and reproduce the problem on staging whenever possible.
  2. Place the definitions above the editing marker and load the failing page or administrator action once.
  3. Read wp-content/debug.log, noting the first relevant error, file path, plugin or theme name, and line number.
  4. Disable the suspected extension or roll back the offending change, then reproduce the request to confirm the cause.
  5. After troubleshooting, set WP_DEBUG, WP_DEBUG_LOG and SCRIPT_DEBUG to false (or remove the temporary definitions) and keep WP_DEBUG_DISPLAY disabled.

Never leave full error output enabled on a public production site. Stack traces can reveal filesystem paths, SQL details, usernames and other information useful to an attacker.

Memory limits: WP_MEMORY_LIMIT and WP_MAX_MEMORY_LIMIT

WP_MEMORY_LIMIT is the amount of PHP memory WordPress requests for front-end requests. WP_MAX_MEMORY_LIMIT is used for administration and heavier operations such as updates, imports and image processing.

The WordPress Hosting Handbook documents these defaults:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
Constant Scope Documented default
WP_MEMORY_LIMIT Single-site front end 40M
WP_MEMORY_LIMIT Multisite front end 64M
WP_MAX_MEMORY_LIMIT Administration and intensive tasks 256M when PHP permits a runtime increase and the existing limit is not already higher or unlimited

These are documented WordPress defaults, not a guarantee from your host. To request higher values, add for example:

define( 'WP_MEMORY_LIMIT', '128M' );
define( 'WP_MAX_MEMORY_LIMIT', '256M' );

Why increasing the constant may not fix a fatal error

WordPress can request a PHP limit, but it cannot defeat a server configuration that blocks ini_set() or enforces a lower php.ini memory_limit. In that case, the host-level setting remains the effective ceiling. A hosting control panel, PHP information page or support response can confirm the actual limit.

More memory can also conceal the real defect. A runaway query, inefficient plugin, oversized import, corrupted image or theme loop may eventually exhaust any allowance. If the fatal error persists after the effective PHP limit is raised, inspect the log, identify the operation consuming memory, test with plugins and the theme isolated, and reduce the import or image workload before requesting still more memory.

What WP_CACHE really does

WP_CACHE is a bootstrap signal, not a cache engine. When it is true, WordPress attempts to load wp-content/advanced-cache.php early in the request. Defining the constant alone does not create cached pages, install a plugin or configure cache rules.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If advanced-cache.php is absent, the constant has little or no practical effect. Page-cache systems may create that drop-in and add their own settings. Persistent object caching is a separate layer: an object-cache.php drop-in can connect WordPress to a Redis- or Memcached-style service without relying on WP_CACHE.

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
Layer Drop-in Role
Page-cache bootstrap advanced-cache.php Loads early when WP_CACHE is true
Persistent object cache object-cache.php Stores database/query objects between requests; separate from WP_CACHE

When disabling a page-cache system, remove or deactivate its drop-in according to that system’s instructions rather than assuming that changing WP_CACHE alone clears cached files.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Security salts, keys and database settings

The sample configuration includes authentication keys and salts generated by WordPress.org’s secret-key service. They make login cookies and related tokens unpredictable. Treat them, database credentials and any API secrets in the file as confidential: keep the file out of public repositories, restrict filesystem permissions and avoid pasting its contents into support forums.

If salts may have been exposed, rotate them. WP-CLI provides the documented command:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
wp config shuffle-salts

Rotating salts invalidates existing authentication cookies, so every logged-in user must sign in again. Schedule the change when administrators know to expect a site-wide logout.

Filesystem and installation constants

WP_CONTENT_DIR

WP_CONTENT_DIR is the absolute filesystem path to the wp-content directory. It is useful when content lives outside the default location, but the value must be a server filesystem path, not a browser URL. A mismatched path can prevent WordPress from finding plugins, themes, uploads or drop-ins.

Database constants and table prefix

The same file normally defines DB_NAME, DB_USER, DB_PASSWORD, DB_HOST and $table_prefix. These values determine which database WordPress opens and which table names it queries. Changing them without migrating the database can make a healthy installation appear empty or produce connection errors.

Choosing settings by environment

Setting area Local development Staging Public production
Debug mode WP_DEBUG true Usually true while testing Normally false after diagnosis
Error display Optional for a private machine Prefer false and inspect logs False
Script debug Enable when working on assets Enable for reproduction False unless actively diagnosing
URL constants Match the local domain Match the staging domain Use only when deliberately overriding database values
Memory values Enough for the tools being tested Match production limits where possible Raise only after checking the host ceiling and root cause

Common failure modes and fixes

The dashboard URL fields are locked

Check whether WP_HOME or WP_SITEURL is defined. Those constants intentionally override the database values and prevent editing the corresponding fields. Change the file, not the form.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The site redirects forever after a migration

Compare both URL constants with the canonical domain, HTTPS status, port and subdirectory. Remove stale definitions, clear proxy and page caches, and verify that the reverse proxy passes the correct scheme.

Visitors see PHP warnings

Set WP_DEBUG_DISPLAY to false and disable PHP display errors, while leaving logging enabled long enough to capture the fault. Do not treat hiding output as fixing the underlying error.

A cache constant appears to do nothing

Inspect whether wp-content/advanced-cache.php exists and whether the page-cache system that created it is active. For object caching, check separately for object-cache.php and its service connection.

WordPress still reports an exhausted memory limit

Confirm the effective PHP memory_limit, not merely the requested WordPress value. Then investigate the plugin, theme, import or image-processing task that consumes memory.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

All users are logged out unexpectedly

Authentication salts were likely changed. This is expected after a deliberate salt rotation; verify the change was authorized and have users sign in again.

A safe editing checklist

  • Back up wp-config.php and the database.
  • Use the active file for the correct environment; managed hosts sometimes keep configuration outside the web root.
  • Place definitions above the editing marker.
  • Use single quotes, semicolons and valid PHP syntax.
  • Define each constant once and remove stale duplicate blocks.
  • Keep secrets out of version-control logs and public bug reports.
  • Test the front end, login, media upload, updates and one representative administrator task.
  • Disable temporary debugging and script settings after diagnosis.

Handled this way, wp-config.php remains a precise control layer: URL constants separate the public and application addresses, debug constants separate logging from display, memory constants express a request rather than override the server, and cache behavior depends on the correct drop-in rather than on a single switch.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.