How to Update WordPress through wp-config.php

Update WordPress

There is very easy and secure way to update your WordPress installation by providing FTP info in the wp-config file. All you have to worry about security. If someone were to gain access to your database then they would also have access to your entire server. So by using the following methods, you can reduce the risk.


Editing wp-config.php


At the bottom of your wp-config.php file add the constant values, so the database will not store this information. As well this will make the database smaller and ultimately it will improve the site performance.

define('FTP_HOST', '');
define('ftp_user', 'username');
define('FTP_PASS', 'password');

Secure Connection

To make a connection more secure and reliable add the following line (default: false):

define('FTP_SSL', true);


If your WordPress installation is not located in the root directory of the FTP server then you can define the location as follows:

define (FTP_BASE’,’…’);

If you have moved the plugin directory or all other content folders. Then, You specify the full path using these two constants:

define('FTP_CONTENT_DIR', '...');
define('FTP_PLUGIN_DIR', '...');


To adjust the method used by WordPress for the file system, you have to change following values, which hides errors in case something goes wrong with file permissions or if some errors have occurred. Keep in mind most of the time the default values will work just fine.

define('FS_METHOD', 'direct');

The following methods are possible:

  • direct (default) – PHP file system functions
  • ssh – SSH PHP Extension
  • ftpext – FTP PHP Extension
  • ftpsockets – PHP socket extension

The constants FTP_PUBKEY, FTP_PRIKEY display the paths to the SSH public key and private key SSH specify.

Delete existing data open this page after login to admin panel, This page will show the all setting options. Search for the entry ftp_credentials, its value should be hidden, If this is present, you have already stored the FTP data in your database. You can delete it by simply removing the value in the ftp_credentials field on the options page, then scrolling to the bottom, and pressing save. You should be very careful doing this though as there is potential for your website to be broken when doing this.

Leave a Reply

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

You May Also Like