I have successive hooks to an action which are passed an associative array like: do_action($array)
I am trying to update the values in this array in the multiple add_action
calls, however each add_action is getting a copy of the passed array, not a reference.
How do I pass a reference? I am using PHP 5.
The way to pass by reference to a WP action is with:
do_action_ref_array('action_hook', array(&$data) );
do_action
which is hooked usingadd_action
is not meant for altering values more then its meant for executing your function at a certain point. Instead useapply_filter
which is hooked usingadd_filter
which is meant to allow altering a value.