• I know you can change the default folder for uploads with a simple adjustment to the wp-config file, and I know you can turn off the option to save in folders based on month and year, but is there any way to change that system entirely?

    I would like to have WordPress store attached files in directories based on the post’s custom taxonomies and/or title. Is this possible?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    You can control the folder destination with the ‘upload_dir’ filter, but you do not have access to related post information from within the filter callback, so determining the correct folder could be difficult.

    In fact, the entire wp_handle_upload() process does not have such access. You would need to concoct some scheme to place such information somewhere to be found by a subsequent filter callback from where such a relationship is known. I think it only exists with the attachment post. Note that uploads can occur with no attachment, such that no post relationship exists, where do you put such files?

    I’m not sure if the attachment post happens before or after the upload, so the possibility of this is questionable. As another line of attack, one could let the upload happen to a single temporary location (besides the normal temp folder), then move the file once the post relationship is known.

    I’m not able to fully answer your question, but at least you have an idea of what’s involved.

Viewing 1 replies (of 1 total)
  • The topic ‘Media uploads directory structure’ is closed to new replies.