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', '/');
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', '');

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?

  • try setting WP_CONTENT_DIR to the wp-content directory the rest should be done for you by WordPress. – Bainternet Jun 16 '11 at 23:37
  • Agreed you can use the WP_CONTENT_DIR as per the codex page – xLRDxREVENGEx Jun 17 '11 at 0:24
  • Also note that it does not matter if you use a cdn to load the objects to but might involve extra coding for uploads – xLRDxREVENGEx Jun 17 '11 at 0:25
  • Setting WP_CONTENT_DIR doesn't change anything. You're required to set WP_PLUGIN_DIR even if you set wp-content. Either way, it doesn't affect uploads. I realized, though, that plugins and WP upgrades are done via FTP. File uploads, however, use PHP -- not FTP. So a wp-config change may not be the route to take. – developdaly Jun 17 '11 at 3:09
  • See related question and answer: wordpress.stackexchange.com/questions/52042/… – developdaly May 31 '12 at 21:11

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.