5

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

16

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
}
| improve this answer | |
  • 2
    is there any hook just before inserting into database? – Atif Mohammed Ameenuddin Nov 2 '12 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 '15 at 14:23

Your Answer

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