0

I know that i should use Filesystem API to write files and I understand why but is there any difference if I read file with wp_filesystem or plain PHP? And what about listing directories?

Consider this example: In wp-content I have my-plugin-templates-folder which has to be listed by my-plugin. Does anybody met with configuration which disallow webserver process list this directory so I should use wp_filesystem?

1 Answer 1

0

No you don't, and not even sure if you can use it for listing files in directories. The only limitation on reading files is that they will be readable to the web server, and obviously plugin directories has to be readable for the web server to be able to read the PHP files.

Now, if you are trying to read something outside of the wordpress file structure you might need to use the filesystem API.

2
  • Thank you for your reply. :) It's possible to list directories via filesystem API, just look here Nov 16, 2015 at 16:51
  • ok, never used the API itself, just assumed it depends on the capabilities of the FTP server on the other side. Nov 16, 2015 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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