Add a context flag to the 'upload_dir' filter
|Reported by:||ulfben||Owned by:|
Since 2.7 I started getting a lot of bug reports from users of my plugin: Custom Upload Dir. It hooks into the 'upload_dir'-- filter and massages the paths according to the users preferences.
The problem is that the filter seems to be run excessively and from some very strange places:
Since 2.7 upload_dir is run whenever we visit the WordPress' Media Library. On my development install with ~1400 files and 160 pages in the Media Library, the filter is run about 160 times for viewing the first page...
It is run whenever we delete an attachment. It is run from wp_get_attachment_url and from wp_get_attachment_image_src - meaning that anyone using the Cleaner Wordpress Gallery-plugin will have upload_dir called four times per thumbnail displayed...
Naturally I have updated my plugin to quick bail and do nothing on these dry runs. But my question is - is the behaviour intentional?
Change History (12)
- Keywords dev-feedback needs-patch added; upload_dir custom upload dir filter media library empty runs removed
- Priority changed from normal to low
- Type changed from defect (bug) to enhancement
- Component changed from General to Upload
- Milestone changed from 2.8 to 2.9
- Owner anonymous deleted
- Summary changed from Filter 'upload_dir' is called excessively for (seemingly) no reason to Add a context flag to the 'upload_dir' filter
- Keywords close added; dev-feedback removed
- Milestone changed from 2.9 to Future Release