Question

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?

Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à wordpress.stackexchange
scroll top