WP Conditional Media Folder
This WP Conditional Media Folder Wordpress plugin automatically saves uploaded media files to custom server directories based on configurable filename or MIME type rules while ensuring full integration and accessibility within the WordPress Media Library.
by Andrea Barbagallo (BotheorY) · github.com/botheory/wp-conditional-media-folder · website
★ 0stars
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/botheory/wp-conditional-media-folder/archive/refs/heads/master.zipA WordPress plugin that conditionally saves media files to a custom folder based on filename or MIME type rules.
Features
- Custom Storage Path: Save files anywhere on the server filesystem (absolute path).
- Custom URL Mapping: Ensure files are served correctly by mapping the path to a URL.
- Advanced Rules Engine:
- Logic: Rules are processed with OR logic. Conditions within a rule use AND logic.
- Conditions:
- Filename starts with
- Filename ends with
- Filename contains
- Min filename length
- Max filename length
- MIME Type (e.g., image/jpeg, application/pdf)
- Seamless Integration: Files appear in the Media Library regardless of storage location.
Installation
- Clone this repository into wp-content/plugins/.
- Run composer install (if dependencies are added later).
- Activate via WP Admin.
Configuration
Go to Settings > Conditional Media Folder.
- Custom Folder Path: Enter the absolute path (e.g., /var/www/static_assets/special).
- Custom Folder URL: Enter the public URL (e.g., https://cdn.mysite.com/special).
- Add Criteria: Add as many rule sets as needed.