[wp-trac] [WordPress Trac] #16849: Add a filter for $overrides in wp_handle_upload()
WordPress Trac
wp-trac at lists.automattic.com
Fri Apr 8 03:25:47 UTC 2011
#16849: Add a filter for $overrides in wp_handle_upload()
-------------------------------------+------------------------------
Reporter: iandunn | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Plugins | Version: 3.1
Severity: minor | Resolution:
Keywords: has-patch needs-testing |
-------------------------------------+------------------------------
Comment (by iandunn):
Hey Jakub, thanks for writing the patch. I'm not sure it's correct,
though. I think the filter should actually go before {{{if ( is_array(
$overrides ) )}}}, shouldn't it?
We want to let a plugin modify/overwrite $overrides before $overrides gets
used. The way the patch is written now, the filter could only be used if
$overrides was already passed in, which won't always be the case.
Also, you forgot to wrap the {{{if}}} block in brackets, so the
{{{extract()}}} statement would get called even if the condition was
false.
I think below {{{$file = apply_filters( 'wp_handle_upload_prefilter',
$file );}}} would be a good place for it. It doesn't need to be wrapped in
an {{{if}}} statement or anything, so it would just be
{{{
$file = apply_filters( 'wp_handle_upload_prefilter', $file );
$overrides = apply_filters( 'wp_handle_upload_overrides', $overrides );
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/16849#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list