[wp-trac] [WordPress Trac] #8753: Filter 'upload_dir' is called
excessively for (seemingly) no reason
WordPress Trac
wp-trac at lists.automattic.com
Mon Dec 29 22:52:27 GMT 2008
#8753: Filter 'upload_dir' is called excessively for (seemingly) no reason
--------------------------+-------------------------------------------------
Reporter: ulfben | Owner: anonymous
Type: defect (bug) | Status: new
Priority: normal | Milestone: 2.8
Component: General | Version: 2.7
Severity: normal | Keywords: upload_dir, custom upload dir, filter, media library, empty runs
--------------------------+-------------------------------------------------
Since 2.7 I started getting a lot of bug reports from users of my plugin:
[http://wordpress.org/extend/plugins/custom-upload-dir/ 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
[http://justintadlock.com/archives/2008/04/13/cleaner-wordpress-gallery-
plugin 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?
--
Ticket URL: <http://trac.wordpress.org/ticket/8753>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list