There is no such a solution out of the box, and any files uploaded to WP are publically available to anyone who can access the domain, so you might want to keep that in mind.
You’ll need to code a solution, possibly as follows:
- on post creation, use
wp_insert_post
to create the require folder. - Use something like
glob($root_folder.$post_slug . "/*.{jpg,jpeg,png,pdf}",GLOB_BRACE)
to list all files in the post-specific folder . (Note, if the slug is ever changed, you’ll need to manually rename the folder or automate it somehow. - Use
before_delete_post
to delete the folder & all files.
Related Posts:
- Pulling images from the media folder category to display inside a page
- Show more than 20 items in pages or posts edit dashboard
- WordPress 3.5 Media Manager – add a button
- How to call WP3.5 Media Library manager?
- How to create virtual pages with information from user meta profile fields?
- Increment Page Order As Pages Are Created
- Where does the 404 redirection happen?
- How to limit page pagination
- Add custom text at bottom of every page?
- Remove specific page/post from feed
- Best way to strip character entities (%20 etc)
- Creating custom page
- Want Page Title to show on menu, but not on page
- Personal page for every user (not just authors)
- Create ghost page
- load common thank you template with different content for different pages
- List pages by custom field?
- Attach media to multiple posts
- Send mail from page using wp_mail
- Edit page’s “Restore the backup” link does nothing
- Load specific page template based on URI
- Show preview posts and pages to clients
- Display attachments by the ID of the post being edited in the wp.media frame (frontend)
- Site url is not showing the home page
- I can’t edit my homepage – the page editor is just blank [closed]
- Allow Editor Role to Edit Media
- Bulk image importing from folders
- Page redirects to archive
- Restricting Pages based on Hierarchy and User Role
- Pages Column Sorting WordPress Version 3.0.3
- Adding Page URL to the Pages Admin Table
- page-name.php doesn’t execute on custom template
- Add categories and posts to page hierarchy
- Hide page templates without using ‘unset’
- Custom page with queries returns 404
- WordPress Site Page Exists but Error 404
- page.php is not called, falls back to index.php
- Custom page in archive page for certain category
- Is it possible to check for shortcodes on a page?
- WordPress 3.2 – removed ability to select a page template in the page attributes when adding a new page?
- Can I “protect” a page with a form asking for an email address?
- How to disable (and hide) the Media Library for certain users?
- Use same page-mypage.php template for several pages
- Is it possible to restrict access to specific pages in the admin area based on the page slug?
- Make “default” wordpress pages & features unaccessible
- Remove Media File Items From Server That Do Not Exist in Media Library
- Set a variable to using in redirected page
- creating single page with 2 columns while theme is 3 column
- Outputting content from page
- Use an archive as the parent of a page?
- Displaying the blog entries in a Page (using get_posts to retrieve the posts)?
- Efficient way to move media folder to another folder
- Make inline uploader (plupload) on options page upload to a specific folder
- what does the symbol “?” mean and how can i edit that page?
- Show children connected to parent pages
- How to get an array of pages ID by some page’s slug and all its children pages in get_posts() function?
- Restrict specific private page to a specific user
- How to remove a page in its entirety
- Post-processing of the image failed
- Set different heights per screen size with inline styles CSS into the ‘Text’ section of a Page
- Editing Pages Icons Are Not Showing Up – Why is this happening?
- Some pages can’t be updated – post_content field not updating
- How to add custom php file to right sidebar?
- Mailchimp RSS feed work with single wordpress page?
- Cannot pull WYSIWYG content
- How can I change the background color of a contact box? [closed]
- Press This for Page
- Supress listing of virtual pages
- How to limit the pages shown in the page manager to those created by the logged in user?
- Is it better to set social media sharer in entry-footer.php or comments.php in WordPress blog?
- Get All Pages as strings in array
- Hook into backbone to add js to wp-admin -> media library?
- Attach link to pages accoding to tags
- How can I add a new page in the pages tab that belongs to specific theme?
- New page has incorrect URL
- Insert media while posting is not working with new wordpress update
- Issue with page not erasing
- My page won’t publish
- Separate Editing from Publishing for pages
- Call a function on every wordpress pages only
- Echo page path suffix only – not the title, path or permalink
- Why does the default Insert/edit link function in Visual mode in posts or pages produce full urls?
- Programatically create multiple pages by passing in array of info
- Custom admin menu for a selection of pages
- how to print the content of pages inside the front end area
- How do I make just one of my pages a Blog Page?
- Standard way of creating profile pages with custom content for each user?
- How to show parent pages on a specific page if user is logged in?
- How to add or remove metabox each page separately?
- Retrieve page content and pass to PHP?
- How to make in post Parent page children page list nummbered
- Get moderation notifications on one post only
- Advanced Multi Tier Navigation across columns
- How To Display Pages Based On Subscriber Signup Date
- How to preview a page instead of a category?
- Display random page
- Custom wp_list_pages() function
- Custom SINGLE page with custom metaboxes and custom template
- What is the proper use of guid for images in wp_posts?
- How to change the default location where new post gets stored?