I am making a website for my local primary school, and I have each class page as a separate page template. Rather than have all their uploads go into the general /uploads/ folder I'd like to direct uploads to certain folders based on their page template, so that page-class1.php media uploads will always go to /uploads/class1/ and page-class2.php will go to uploads/class2/ (or some specific folder).

I can then control these uploads and sort them by size/date if one class is getting too many uploads I can ask them to limit/clear them. And setting this system in place may allow us to protect them differently depending on the class and content.

I would have thought this was a fairly common issue but I can't seem to find this question asked on this site (specific to page templates or even post-type). So, what is the method to direct uploads to different folders, based on the page template?

1 Answer 1


Well I was privileged enough to get the tumbleweed badge for this question. But I found the answer. Easy enough.

Custom Upload Dir Plugin. Perfect for the job. Well, almost. With a little tweaking.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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