I've added and network activated a plugin with this code:

add_filter('authenticate', 'my_authenticate', 1000, 2);

function my_authenticate($user, $username){

    // We never arrive in this function

From a debugger I can see that we hit the add_filter line but we never enter the my_authenticate function.

Why's that?

And how do I fix the problem?

  • 1
    What do you mean "never arrive"? What is this "debugger" you are using? Nov 27, 2015 at 17:44
  • When do you expect this filter to fire? What are you doing to test it?
    – s_ha_dum
    Nov 27, 2015 at 17:51
  • @TheDeadMedic xdebug.
    – Snowcrash
    Nov 27, 2015 at 18:04
  • @s_ha_dum I'd expect it to fire between the time the user clicks Login and the time they see the Dashboard.
    – Snowcrash
    Nov 27, 2015 at 18:05
  • 1
    There's a redirect between login & seeing the dashboard - unless you're using debug logs, you won't see anything. Nov 27, 2015 at 18:17

1 Answer 1


I can think of a few possibilities, though there certainly could be more.

  1. On successful login there is a redirect to the dashboard meaning that if you expect to see something output by that function, you won't. Try this:

    add_filter('authenticate', 'my_authenticate', 1000, 2);
    function my_authenticate($user, $username){
      var_dump($user, $username);
      // We never arrive in this function
      return $user;

    Login, and you should see output. Remove the die and you won't see anything because the output is wiped out by the redirect, in a sense.

  2. The authenticate filter is inside a pluggable function, so it is possible that that function has been replaced by the theme or a by a plugin and that filter is actually not being called.
  3. You are running your filter late so some earlier filter could (though it would be bad form in my opinion) be interrupting things before your callback gets a chance to fire-- remove_all_filters() for example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.