Using the constant overrides in wp-config I’m able to define a remote FTP server that plugins will be added to when installed using the WP interface.

define('FS_METHOD', 'ftpext');
define('FTP_BASE', "https://wordpress.stackexchange.com/");
define('FTP_CONTENT_DIR', '/public_html/example.com/wp-content/');
define('FTP_PLUGIN_DIR', '/public_html/example.com/wp-content/plugins/');
define('FTP_USER', 'username');
define('FTP_PASS', 'password');
define('FTP_HOST', '123.123.123.123');

What’s weird to me is that there isn’t a constant setup for themes or uploads. Themes I don’t care about (but its still weird) … I want uploads to be put on the remote server though. Ideally there would be an FTP_UPLOADS_DIR that could be overwritten the same way.

Any ideas on how to get around this?

1 Answer
1

IMHO a better approach would be adding the remote server’s directory as a locally mounted directory and use this as wp-content directory. Doing this on the block/filesystem level means that WordPress won’t notice a thing, since it appears to WordPress as normal local directory. You may want to have a look at sshfs in order to mount the directory. Using this has the added benefits of:

  • not having to put your ftp password in file
  • no (slow/unreliable) php code having to act as ftp client
  • no need for ftp an insecure protocol by itself
  • no need for a ftp-server on the remote server
  • no need to change WordPress config

Leave a Reply

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