While it is widely recommended that you don’t edit the wp-config.php file, there are some circumstances in which you may need to edit this file. Hence, in this tutorial, we will be showing you two different methods to edit wp-config.php file.
Editing the wp-config.php File
Before proceeding with the methods, it’s important to first understand what the wp-config.php file is.
The wp-config.php file is an important WordPress configuration file that is generated when you install WordPress.
TEXT AD1The file is a WordPress core file, which contains important data like your database name and WordPress configuration settings.
Since the file is crucial in running your website, even making a tiny mistake means that you will end up breaking your website. Hence, it is generally recommended that this file is not edited, unless absolutely required.
In some cases, it is required, which is why we will be showing you two different methods to edit wp-config.php file.
The first method is very simply and involves using cPanel, which a lot of users have. If you do not have access to cPanel, then don’t worry because you can follow the second method, which makes use of a plugin to edit the wp-config.php file.
Note: Before proceeding with any of the methods below, make sure you make a backup of your entire website, in case something goes wrong.
Method #1: Edit wp-config.php File Using cPanel
Since most users tend to have a cPanel account, in the first method, we will be showing you how to edit wp-config.php file using cPanel.
1. Log into cPanel and click on File Manager
The first step is to login to your cPanel account. Usually your cPanel account can be reached by typing in your website name followed by /cpanel (www.example.com/cpanel).
Once you have logged into cPanel, click on the File Manager option, which is located under the heading Files.
2. Select public_html > wp-config.php file and click on Edit
Once File Manager opens, click on public_html from the left sidebar menu. Next click on the wpconfig.php file and then click on Edit from the top menu.
TEXT AD2If you cannot find the wp-config.php file there, then it is probably in the root directory. Click on home from the left sidebar menu and then try finding the wp-config.php file.
3. Click Edit on the pop-up
After you click on Edit from the top menu bar, you will see a warning pop-up. From this pop-up, click on Edit to edit the wp-config.php file.
That’s it, now you can make whatever changes you needed to make to the wp-config.php file.
Method #2: Edit wp-config.php File in WordPress
In case you do not have cPanel, then you make use of this method to edit wp-config.php file in WordPress.
This method makes use of a plugin called WP Config File Editor.
The plugin gives you a wide variety of options that you can change without having to physically type in code.
It’s a great, friendly alternative, especially for those who are uncomfortable with editing php files.
Let’s say for example you are looking to disable automatic updates. Simply tap on the Upgrade tab in the plugin and check the Disable Automatic update option and the plugin will automatically write the relevant code in the wp-config.php file.
If you are looking to do something else in the wp-config.php file, then simply work through the different tabs of the plugin and see if you can find the option. The plugin has a wide variety of configuration options, so it is highly likely it will have what you are looking for.