One of the most potent files on your WordPress website, WP-config, is crucial to how WordPress functions in the background. Most novices are unaware of a few extremely helpful WordPress configuration tips. We’ll discuss some of the most practical WordPress setup tips in this post so you can diagnose, improve, and protect your WordPress site.
How Do You Use These WordPress Configuration Tricks?
WordPress includes a powerful configuration file named wp-config.php. It is contained in the root folder of every WordPress site and includes key configuration options.
For additional information, visit our instructions on how to change the wp-config.php file in WordPress.
All of the finest WordPress hosting companies offer 1-click WordPress installation, which means you will never have to alter the wp-config.php file during the installation. This is the key reason why many people are unaware of the potential of this file.
Your WordPress site may be optimized, secured, and troubleshooted with the wp-config file.
A small error in the wp-config.php file’s code might render your website unavailable because it is a very potent weapon. Always make a full WordPress backup before making any changes, and only update this file when absolutely necessary.
Following that, let’s look at some practical WordPress setup tips you may use for your website.
1. The Settings for the Basic WordPress Configuration
During WordPress installation, you only need to fill in the database settings. If you don’t have a wp-config.php file, you’ll be prompted to create one by entering your database details.
WordPress will attempt to store these settings automatically by creating a wp-config.php file. However, if it fails, you will have to manually add them.
To do so, you’ll need to use an FTP client to connect to your website. After connecting, rename the wp-config-sample.php file to wp-config.php.
Following that, you may change the newly formed wp-config.php file. Change the following lines to include your database information:
define('DB_NAME', 'database-name'); define('DB_USER', 'database-username'); define('DB_PASSWORD', 'database-password'); define('DB_HOST', 'localhost');
Remember to save your modifications and re-upload the file to the server.
2. Using WordPress Security Keys
The basic WordPress installation automatically adds security keys to your configuration file. These security keys are used to provide an extra degree of protection to your WordPress login and cookie authentication.
You may always regenerate security keys if you suspect someone is accessing your website without proper authentication. Changing security keys will lock out all currently logged in users.
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' );
See our post on WordPress security keys and how to utilize them for more details.
3. Change the prefixes of the WordPress table.
A common basic WordPress installation prefixes all WordPress database table names with wp_. Some WordPress security experts feel that altering the table prefix can improve the security of your WordPress database.
To do so, edit the following line in your WordPress setup.
$table_prefix = 'wp_';
If you’re doing this for an existing website, you’ll need to modify the table prefix in your WordPress database as well. See our article on changing the WordPress database prefix for instructions.
4. WordPress Debugging should be enabled.
When in debug mode, WordPress has a handy debugging function that allows you to observe or conceal WordPress issues. To enable this, add the following rule to your WordPress configuration file.
define( 'WP_DEBUG', true );
You may also enable debugging while concealing failures on your website and saving them instead in a log file. Add the following lines to your configuration settings to do this.
define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_DISPLAY', false );
This will generate a debug.log file in your website’s wp-content folder, including all debugging problems and alerts.
5. Changing the URL of Your Website or WordPress
the Settings » General page. However, you may be unable to do so if you do not have access to your WordPress site, are experiencing redirect difficulties, or have just relocated your site.
In such a scenario, you may modify your site and WordPress URLs by adding the following lines to your wp-config.php file:
define('WP_HOME', 'http://www.example.com'); define('WP_SITEURL', 'http://www.example.com');
Replace example.com with your own domain name, don’t forget to do so.
6. Replace the File Permissions
In most cases, you can configure your WordPress and site URLs from If your host has restricted file permissions for all user files, WordPress allows you to override them. Most users do not require this; however, it is available for those that do.
define('FS_CHMOD_FILE', 0644); define('FS_CHMOD_DIR', 0755);
7. Changing Post-Revision Preferences
WordPress includes a very handy function called post revisions, which allows you to reverse changes to your posts and pages by returning to a prior version or an autosave.
The configuration file allows you to disable or adjust post-revision options. Here are some options for post-revision settings.
By adding the following code, you may adjust how frequently WordPress keeps an autosave as a revision:
define('AUTOSAVE_INTERVAL', 120); // in seconds
Depending on how long it takes to write, some articles on your site may have hundreds of post changes. If you believe that feature irritates you, you can restrict the amount of modifications per post.
If, for any reason, you wish to disable the post revisions function entirely (which is not suggested), you may do so using the following code.
define( 'WP_POST_REVISIONS', false );
8. WordPress Trash Configuration
Trash is a recycling bin function included with WordPress. When a user submits a post to trash, it remains on your website as garbage for the following 30 days. After that period, WordPress deletes them permanently.
You may modify this behavior by adjusting the number of days you want the garbage to be kept.
define( 'EMPTY_TRASH_DAYS', 15 ); // 15 days
If you don’t like this functionality, you may deactivate it by adding the following function:
define('EMPTY_TRASH_DAYS', 0 );
9. Adding FTP/SSH Constants to WordPress Settings
WordPress core, themes, and plugins can all be upgraded from the admin panel by default. Some servers demand an FTP or SSH connection every time you want to upgrade or install a new plugin.
You may configure the FTP or SSH constants using the codes, which will ensure that you never have to bother about them again.
// forces the filesystem method: "direct", "ssh", "ftpext", or "ftpsockets" define('FS_METHOD', 'ftpext'); // absolute path to root installation directory define('FTP_BASE', '/path/to/wordpress/'); // absolute path to "wp-content" directory define('FTP_CONTENT_DIR', '/path/to/wordpress/wp-content/'); // absolute path to "wp-plugins" directory define('FTP_PLUGIN_DIR ', '/path/to/wordpress/wp-content/plugins/'); // absolute path to your SSH public key define('FTP_PUBKEY', 'https://cdn2.wpbeginner.com/home/username/.ssh/id_rsa.pub'); // absolute path to your SSH private key define('FTP_PRIVKEY', '/home/username/.ssh/id_rsa'); // either your FTP or SSH username define('FTP_USER', 'username'); // password for FTP_USER username define('FTP_PASS', 'password'); // hostname:port combo for your SSH/FTP server define('FTP_HOST', 'ftp.example.org:21');
Note: Remember to change the WordPress path and ftp.example.com with your own FTP Host details.
10. Please Enable Automatic Database Repair
The WordPress database may be automatically repaired and optimized thanks to a built-in capability. But by default, this function is disabled.
You must include the following line in your WordPress configuration file in order to make this functionality available.
You must go to the next website to optimize and fix the WordPress database after adding this.
Don’t forget to substitute your own domain name for example.com. A straightforward page with options to repair or optimize the database will appear. You may view this page without signing in.
11. Develop the PHP memory limit.
PHP memory exhaustion is the root cause of many WordPress issues. You may raise the PHP memory limit by editing the wp-config.php file. Simply duplicate and paste the code below:
12. Relocating the wp-content Directory
WordPress permits you to alternate the place of your wp-content material directory. Some experts feel it might assist to improve WordPress security.
The following code must be added to your wp-config.php file:
define( 'WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/blog/wp-content' ); define( 'WP_CONTENT_URL', 'http://example/blog/wp-content'); define( 'WP_PLUGIN_DIR', $_SERVER['DOCUMENT_ROOT'] . '/blog/wp-content/plugins' ); define( 'WP_PLUGIN_URL', 'http://example/blog/wp-content/plugins');
Don’t forget to substitute your own domain name for example.com.
13. Employ custom user tables
WordPress keeps all user data by default in the databases wp users and wp usermeta. You may specify the table where you want your user information kept by using the function below.
define('CUSTOM_USER_TABLE', $table_prefix.'my_users'); define('CUSTOM_USER_META_TABLE', $table_prefix.'my_usermeta');
14. Allow Multi-Site Networking
Each WordPress site has a multisite feature that allows you to build many WordPress sites using the same installation. See our entire guide on installing and configuring a WordPress multisite network for more information.
Add the following line to your WordPress configuration file to enable multisite functionality:
15. WordPress Configuration File Security
The wp-config.php file, as you can see, includes critical WordPress settings. It is by default located in the root WordPress folder, but you can relocate it. It can be moved outside of your public HTML directory, making it inaccessible to users. If a file is not discovered in the WordPress root folder, WordPress will check in other directories by default.
To restrict access to this file, add the following code to your.htaccess file.
# Protect wp-config.php <Files wp-config.php> order allow,deny deny from all </Files>
We hope you found this post useful in learning some new WordPress setting methods. You might also be interested in our giant list of the top 55 WordPress tips, tricks, and hacks that you can utilize on your site.
If you like this post, please subscribe to our WordPress video tutorials on YouTube. We may also be found on Twitter and Facebook