I want to store all attachments (media) in folders named with each post title.
Example: /wp-content/uploads/my-post-about-stuff/
The folder should contain all media attached to that post.
Is that possible?
I want to store all attachments (media) in folders named with each post title.
Example: /wp-content/uploads/my-post-about-stuff/
The folder should contain all media attached to that post.
Is that possible?
You must be logged in to post a comment.
Disclaimer
post_id
Follow the instructions in the comments, and this code can be adapted to organize the uploads folder by
post_name
(aka: slug),post_author
,post_id
or media type.The plugin Custom Upload Dir has this capability:
::Screenshots::
For our internal webpage, we used the code from here and made it use the top level parent if the upload is from a page. Since it is internal, we didn’t care about the username being visible. This allowed us to break up the uploads by something close to departments.