How to set path with WP_Filesystem and ftp base / chroot

After changing FTP_BASE in my wp-config i found the update function of WP broken. Then i realize the update function work the same way and don’t need any additional settings.
In wp-admin/includes/update-core.php i found the usage of $wp_filesystem->wp_content_dir(). This solves my problem too.

On http://xref.wordpress.org/branches/3.8/WordPress/Filesystem/WP_Filesystem_Base.html you will find a list of possible useful functions:

string wp_content_dir () 
string wp_lang_dir () 
string wp_plugins_dir () 
string wp_themes_dir ([string $theme = false])

In fact @otto give my the answer earlier (Using wp_filesystem in Plugins), here he wrote:

When using the $wp_filesystem, there’s a handy function call for
getting the content directory path: $wp_filesystem->wp_content_dir();.
You need to use this function because the “remote” directory path may
not be the same as the “local” directory path.

Leave a Comment