6

how can I tell WordPress, that if a user registers, it shall execute my function?

1 Answer 1

20

You can use user_register action hook which fires after a user has registered and passes $user_id as a variable:

add_action('user_register','my_function');

function my_function($user_id){
  //do your stuff
}
2
  • 2
    is there any hook just before inserting into database?
    – Atif
    Nov 2, 2012 at 21:42
  • 1
    In case that someone want to know @AtifMohammedAmeenuddin question. You can use register_post to hook before register user to db.
    – vee
    Jul 8, 2015 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy