WordPress.org

Ready to get started?Download WordPress

Forums

do_action_ref_array (3 posts)

  1. Colin Robinson
    Member
    Posted 2 years ago #

    I'm trying to use this hook
    do_action_ref_array('user_profile_update_errors', array ( &$errors, $update, &$user ) ); but I'm not having much luck getting it to work.

    Could someone add an example to this page?
    http://codex.wordpress.org/Function_Reference/do_action_ref_array

  2. Mark / t31os
    Moderator
    Posted 2 years ago #

    Part of the function's description(on the codex page you linked to)..

    This function is identical to do_action, but the arguments passed to the functions hooked to $tag are supplied using an array.

    There's an example on the do_action page.
    http://codex.wordpress.org/Function_Reference/do_action

  3. gary_mazz
    Member
    Posted 2 years ago #

    I have just tried do_action_ref_array(). It doesn't work. It still passes the array by value, not reference.

    @Moderator,, Passing by reference allows the each hook to modify the array and pass those alterations to the next hook. The current method, passing by value, does not propagate the changes to the array. They remain in scope to the hook only.

    To work around the issue, make the array global.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.