The real problem I have when using the $wp_filesystem
is defining the correct paths. In the documentation of the filesystem the path (for example for the plugins directory) is usually set like this: $plugin_path = str_replace(ABSPATH, $wp_filesystem->abspath(), MY_PLUGIN_DIR);
I tried to understand this but I failed because I couldn't find out what $wp_filesystem->abspath()
is actually supposed to return. When I var_dump()
it I get false
. Could somebody explain to me why we can not simply use the ABSPATH
variable in functions like $wp_filesystem->put_contents()
?