Do you have no idea what a wp-config file is and have read a tutorial that instructs you to edit it? If you need anything, we have you covered. You will learn how to properly edit the WordPress wp-config.php file in this tutorial.
What is wp-config.php File?
This is actually a WordPress configuration file that defines how WordPress should connect to a database, how it handles the memory, editor features, and other useful configurations.
This file is already provided on an Elementor Cloud website. There is nothing you need to do to have that file created.
WordPress's configuration file (wp-config.php) contains more than just information about the database. Later in this article, we'll go into more detail about them.
Create Amazing Websites
With the best free page builder ElementorStart Now
You should avoid tampering with this file unless you have no other choice, as it contains sensitive information.
Because you're reading this article, you'll need to change the wp-config.php file. To avoid a disaster, follow the steps outlined in the following paragraphs.
Creating a backup on Elementor Cloud
The first thing you need to do is to create a complete backup of your Elementor cloud website. The wp-config.php file is so crucial to a WordPress site that a tiny mistake will make your site inaccessible.
We'll then access my.elementor.com and select the website we would like to perform our change and click "Manage this website".
We'll then scroll down until we see the backup section. From there you'll create a manual backup by clicking on "Create new backup".
Once you're done, you would have created a backup.
Editing The wp-config.php File
In order to edit this file, we need to install a plugin on WordPress. We'll use a file manager that gives us access to that file. The plugin we'll install is named: Advanced File Manager.
Once this plugin is installed, you'll just have to enable it. After enabling the plugin, you'll head to "wp-content" and there you'll see the wp-config.php file.
By right-clicking on the item, you'll see further options for editing that file.
Understanding wp-config.php file
Before you start, let’s take a look at the full code of the default wp-config.php file. You can also see a sample of this file here.
In the wp-config.php file itself, each section is well-documented. PHP Constants are used to define nearly all of the parameters on this page.
define( 'constant_name', 'value' );
Useful wp-config.php Hacks and Settings
It is possible to fix many common WordPress errors by altering the wp-config.php file.
Change Uploads Directory Using wp-config.php
The /wp-content/uploads/ directory is the default location for all of your WordPress media uploads. In your wp-config.php file, you can add a line of code that will allow you to move your media files to another location.
define( 'UPLOADS', 'wp-content/media');
Please keep in mind that the uploads directory path is relative to the ABSPATH that is automatically set in WordPress. It's not possible to use an absolute path here.
Disable Automatic Updates in WordPress
In WordPress 3.7, WordPress introduced automatic updates. In the event of a minor update, WordPress sites can now be updated automatically. Even though WordPress's automatic updates are great for security, they can sometimes break the site and render it unusable.
One line of code in your wp-config.php file will stop all automatic WordPress updates from occurring.
define( 'WP_AUTO_UPDATE_CORE', false );
Limit Post Revisions in WordPress
Automated save and revision features are built into WordPress. See our post revisions tutorial to learn how to revert changes in WordPress. WordPress database backups can grow in size if you have a large site.
The number of revisions a post can have is limited by adding the following code to your wp-config.php file.
define( 'WP_POST_REVISIONS', 3 );
Rearrange the "3" with the number of revisions you'd like to keep. WordPress has implemented a new feature that will automatically delete old revisions. In spite of this, all of your previous post revisions remain in your database.
We sincerely hope that this article has provided you with a better understanding of the WordPress' wp-config.php file and the various customizations you can make to it on Elementor Cloud.