I have domains, and specifically WordPress sites, on several different servers. Most of the time when I update plugins, its a simple click and the plugin updates automatically. However, on some domains the update process halts to ask for FTP server information including the server name, login username, and password. I have to type this information in each time for these domains before the updates will install.

This irritating prompt will happen on plugin updates, theme updates and core wordpress updates. If you use any type of management app to manage your wordpress sites, the sites that have this issue will not update automatically. Although the problem is easily fixed by typing in the information when asked, it becomes irritating if you are doing lots of updates to a domain or managing multiple wordpress sites that have this problem.

How to Save FTP Details in WordPress

1) Use your favorite FTP program to access your site.

2) Download the WP-CONFIG.PHP file to your computer to edit. WP-CONFIG.PHP is found in the root folder of your WordPress site. If your wordpress site is in a subdirectory, wp-config.php will be found in the subdirectory.

3) Open WP-CONFIG.PHP in your favorite text editor. I like Notepad++ myself.

4) Place the following snippet of text in your WP-CONFIG.PHP file. I like to place it after the define WP_SITEURL amd define WP_HOME lines, but you can place in anywhere in the config file. Replace the appropriate fields with your ftp server, username, and password information.

//added ftp login credentials to avoid WordPress asking for FTP details every time
define(‘FTP_HOST’, ‘ftp_server_name’);
define(‘FTP_USER’, ‘ftp_username‘);
define(‘FTP_PASS’, ‘ftp_password‘);
//*If you can use a SSL connection set this to true *define(‘FTP_SSL’, true);

 

5) Save the changes to the file and upload the file to your server using FTP. Overwrite the original WP-CONFIG.PHP file that is located on the server.

6) Try to update a plugin, theme, or core WP file to test it.

For all but a handful of domains this worked great. However, for a few domains adding the ftp info into wp-config.php it did not help. Every time i tried to update a plugin, theme, or core file WordPress would ask me for a password again. The problem stemmed from unrecognizable characters in the FTP section of wp-config.php. This was most likely from transferring the file in binary mode instead of ASCII mode for the php file.

NOTE: One of the issues with this option is one of security. If someone hacks the site to the point that they can edit wp-config.php, then they can get all your login details. In order to prevent this issue and harden your wordpress security in the process, its a good idea to place the WP-CONFIG.PHP file in the directory directly above your WordPress site. If your site is in the root directory of the domain, put the WP-CONFIG.PHP file in the directory one level higher than your public_html folder.

You won’t be able to do this if you host multiple wordpress installations in the same domain however.

On some hosts, placing the WP-CONFIG.PHP outside the public_html folder is prohibited. So, if this does not work, please check with your web host on how to do this.

 

Tagged with:

Filed under: TutorialsWeb Site Tasks

Like this post? Subscribe to my RSS feed and get loads more!