[wp-trac] [WordPress Trac] #9886: Pass $this as the second argument in WP_Query filters
WordPress Trac
wp-trac at lists.automattic.com
Thu Feb 25 20:10:44 UTC 2010
#9886: Pass $this as the second argument in WP_Query filters
-------------------------+--------------------------------------------------
Reporter: westi | Owner: westi
Type: enhancement | Status: new
Priority: normal | Milestone: 3.0
Component: Plugins | Version: 2.8
Severity: major | Keywords: has-patch commit early
-------------------------+--------------------------------------------------
Comment(by scribu):
Replying to [comment:18 westi]:
> From memory you need to package the reference up in an array so that you
can pass it to a function which doesn't take a reference explicitly - it
have a variable length arguments list
Here's what I've found while looking in wp-includes/plugin.php:
do_action() contains these lines:
{{{
if ( is_array($arg) && 1 == count($arg) && is_object($arg[0]) ) //
array(&$this)
$args[] =& $arg[0];
}}}
And here is the description for do_action_ref_array():
{{{
* Execute functions hooked on a specific action hook, specifying
arguments in an array.
*
* @see do_action() This function is identical, but the arguments passed
to the
* functions hooked to <tt>$tag</tt> are supplied using an array.
}}}
So, either the docs are wrong or we're using do_action_ref_array() wrong.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/9886#comment:21>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list