I'm new to wordpress. I'm writing my first plugin. I don't understand how to have my function run only after submitting the login form while not running every time I refresh the login page. I tried with authenticate filter. But my function runs every time I refresh the login page.
I don't understand why authentication = accessing login page.
I tried to default
$username to null as argument, something like
my_function($user, $username=null) and check if username is empty, if it is then don't do nothing. The problem is the function doesn't return any errors even if username is submitted.
This could be due to priority. I don't know if I did it correctly but the following didn't work. I tried to set highest priority.
Could someone provide me with a sample function that returns custom error everytime the login form is submitted, even if login and password are correct.