Wp Config.php
define( 'WP_MEMORY_LIMIT', '256M' ); define( 'WP_MAX_MEMORY_LIMIT', '512M' ); Use code with caution.
define( 'WP_AUTO_UPDATE_CORE', true );
The wp-config.php file is the brain of your WordPress site. It stores your database credentials, security keys, and advanced performance settings. Since it doesn't come in the standard download, WordPress creates it for you during installation using a template called wp-config-sample.php . 🛠️ How to Find & Edit It wp config.php
PHP syntax error (missing ; or ' ). Fix: Revert to your backup. If no backup, access the file via FTP and reverse your last change.
Because wp-config.php controls fundamental settings, it is usually protected from public view. You will need to access your server via or a File Manager in your hosting control panel. Since it doesn't come in the standard download,
| Constant | Purpose | Example | | :--- | :--- | :--- | | | The name of your WordPress database | define( 'DB_NAME', 'my_wp_database' ); | | DB_USER | The database username | define( 'DB_USER', 'wp_user' ); | | DB_PASSWORD | The database user's password | define( 'DB_PASSWORD', 'StrongP@ssw0rd!' ); | | DB_HOST | The database server address (usually localhost ) | define( 'DB_HOST', 'localhost' ); | | $table_prefix | Prefix for all WordPress database tables | $table_prefix = 'wp_'; | | AUTH_KEY, SECURE_AUTH_KEY, etc. | Security salts for encryption (increases security) | (Long, random strings) | | WP_DEBUG | Enables PHP error logging for troubleshooting | define( 'WP_DEBUG', true ); | | WP_MEMORY_LIMIT | Increases PHP memory for your site | define( 'WP_MEMORY_LIMIT', '256M' ); | | WP_HOME & WP_SITEURL | Forces the site and WordPress addresses | define( 'WP_HOME', 'https://example.com' ); |
One of the easiest ways for a site to get hacked is through the built-in Theme and Plugin editors in the dashboard. You can disable these entirely so even an admin can't edit code from the browser: define('DISALLOW_FILE_EDIT', true); 6. Relocate the "Brain" for Security If no backup, access the file via FTP
The Ultimate Guide to wp-config.php : Master WordPress Configuration
// ** Authentication Unique Keys and Salts ** // define( 'AUTH_KEY', 'put your unique phrase here' ); define( 'SECURE_AUTH_KEY', 'put your unique phrase here' ); define( 'LOGGED_IN_KEY', 'put your unique phrase here' ); define( 'NONCE_KEY', 'put your unique phrase here' ); define( 'AUTH_SALT', 'put your unique phrase here' ); define( 'SECURE_AUTH_SALT', 'put your unique phrase here' ); define( 'LOGGED_IN_SALT', 'put your unique phrase here' ); define( 'NONCE_SALT', 'put your unique phrase here' );
: Prevents your database from bloating with hundreds of old post drafts. define( 'WP_POST_REVISIONS', 3 ); // Keeps only the last 3 revisions
/** * For developers: WordPress debugging mode * * Change this to true to enable display of notices during development. * It is strongly recommended that plugin and theme developers use WP_DEBUG * in their development environments. * * @link https://codex.wordpress.org/Debugging_in_WordPress */ define( 'WP_DEBUG', false );