0

I'm trying to create a persistent login mechanism in Wordpress (I can't find a plugin, but if there is one, let me know!).

But I'm struggling to find a hook (add_action or add_filter) that runs when the user is initially authenticated by wordpress when logging in.

Does anyone know of an appropriate way to execute code only once when a user logs into wordpress?

2 Answers 2

0

wp_login action is available.

The wp_login action hook is triggered when a user logs in by the wp_signon() function. It is the very last action taken in the function, immediately following the wp_set_auth_cookie() call.

Check this official documentation.

-1

I know it's been a while, but I've since created a plugin to remember users and keep them logged into WordPress (unless they choose to logout).

Just incase anyone else has a similar question.

The plugin is here: https://wordpress.org/plugins/wp-persistent-login/

It does use wp_login at its core, as suggested in the other answer.

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.