WP_Filesystem init

When working with some internal WordPress functions, sometimes you get a “fs_unavailable” “Could not access filesystem” error, and if you look at the source code, there is a comment that says: “Assumes that WP_Filesystem() has already been called and set up”, you might wonder how to call and setup the WP_Filesystem.

To do this, just do the following before you call your function:

WP_Filesystem();

//unzip_file etc …

Leave a Reply