[wp-trac] [WordPress Trac] #49445: Only one argument passed to wp_login callback.
WordPress Trac
noreply at wordpress.org
Sat Feb 15 15:17:29 UTC 2020
#49445: Only one argument passed to wp_login callback.
------------------------------------+------------------------------
Reporter: tmfhokies | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Login and Registration | Version: 5.3.2
Severity: normal | Resolution:
Keywords: | Focuses:
------------------------------------+------------------------------
Comment (by pbiron):
Hi @tmfhokies, welcome to Trac!
The problem you're experiencing is because of the way you're calling
`add_hook()`. `add_hook()` has an optional 2nd & 3rd parameter: the 3rd
is "The number of arguments the function accepts". For more details, see
[https://developer.wordpress.org/reference/functions/add_action/
add_action()].
If you change the call to:
{{{
#!php
<?php
add_action('wp_login', function ($user_login, $user) {
}, 10, 2 );
}}}
you will find the error no longer happens.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/49445#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list