Change WordPress FTP Settings

One of WordPress features is the ability to alert you when an update is available and for admin users to click the update button for WordPress to automatically update itself on your server. It does this by using FTP to transfer the new WordPress files to your server and update the existing install. WordPress can also use the FTP settings to automatically update any plugins and themes that you have installed.

To change the FTP settings installed on your site you can do this inside your wp-config.php file where all your FTP attributes are stored, by using the following constants.

  • FS_METHOD - this forces FTP to use a certain filesystem method with the different options being
    • direct - forces it to use Direct File I/O requests
    • ssh2 - force the usage of the SSH PHP Extension
    • ftpext - utilises the PHP Sockets Class for FTP Access
    • ftpsockets - utilises the PHP Sockets Class for FTP Access
  • FTP_BASE - Path to the WordPress installation folder (ABSPATH)
  • FTP_CONTENT_DIR - Full path to the wp-content folder
  • FTP_PLUGIN_DIR - Full path to the plugins folder
  • FTP_PUBKEY - Full path to your SSH public key
  • FTP_PRIKEY - Full path to your SSH private key
  • FTP_USER - Username used by FTP
  • FTP_PASS - Password used by FTP, not needed if you're using SSH public key authentication
  • FTP_HOST- Host and post used for FTP
  • FTP_SSL - Decide if SSL connection is on or off

You need to use the above as constants in your wp-config.php file and then WordPress will be able to successfully connect via FTP and automatically update your WordPress install, plugins and theme from the admin area.

define( 'FS_METHOD', 'ftpext' );
define( 'FTP_BASE', '/path/to/wordpress/' );
define( 'FTP_CONTENT_DIR', '/path/to/wordpress/wp-content/' );
define( 'FTP_PLUGIN_DIR ', '/path/to/wordpress/wp-content/plugins/' );
define( 'FTP_PUBKEY', '/home/username/.ssh/' );
define( 'FTP_PRIKEY', '/home/username/.ssh/id_rsa' );
define( 'FTP_USER', 'username' );
define( 'FTP_PASS', 'password' );
define( 'FTP_HOST', '' );
define( 'FTP_SSL', false );

To see what other settings you can change from the wp-config.php file try out our wp-config WordPress Generator.

wp-config WordPress Generator

Coveloping Membership

Access to a range of developer tools, get your first month free

Start Your Free Trial

Don't miss out!

Sign up to our newsletter for the latest news from Coveloping

Leave a Reply

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

Code Copied!