I am trying to use wp-filesystem to write css data.I have things working perfect here.

       $filepath = get_template_directory() . '/dynamic/';

But this generate files in theme folder. But what is if I want to generate in upload folder?

I have tried $filepath = wp_upload_dir() . '/dynamic/ But it does not work.


Just try

        $uploads = wp_upload_dir();
        $uploads_dir = trailingslashit($uploads['basedir']);
        $filepath = $uploads_dir . '/dynamic/';

It may help

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.