Use WP_Filesystem outside WP_admin

In the functions.php I included an file called ThemeOptions.php where I load options and generate the custom css. I did it very simple with file_get_contents, fopen and fwrite. Of course this approach triggered several warnings in Theme Check and thats why I am trying to implement in ThemeOptions.php the WP_Filesystem approach.

At the moment I get an ugly error from the site :Fatal error: Call to undefined function WP_Filesystem() in , and from what i understood its because i call WP_Filesystem outside WP_admin.

Read More

Is there any way of calling WP_Filesystem from outside WP_admin ? More specifically from a file included in functions.php ?

Thank you

Related posts

Leave a Reply

1 comment