The title is handful but so is the issue. I am building a theme than can generate/compress CSS files . So I need to move some files around etc. All this was working flawlessly until I figured out that once you set


to anything else but direct , you need credentials to read/write to files. Which immediately trows away the use of WP filesystem

or any kind of files moving around freely.

Now I can tell admins to do this

define("FTP_HOST", "localhost");
define("FTP_USER", "yourftpusername");
define("FTP_PASS", "yourftppassword");

but none of it sits well with me. It takes away from dynamic theme sense, and to be honest I dont want to tell user to do any kind of FS_METHOD changing so that I dont put anyone in harms way.

I did read this http://ottopress.com/2011/tutorial-using-the-wp_filesystem/

and yes I can put everything inline not an issue , but 1 problem I have is that I need to generate ad least custom.css file on theme install for the user. Why generate you might ask , so that when theme is updated we dont override those files.

So the long story short , is there no way to go around this and work with files normally without restrictions or fear that if we change some settings users might get hacked.

Any help and suggestion is most welcome.


Is there a way to use WP filesystem without credentials when FS_METHOD is NOT set to direct?

Short answer: No.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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