WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 9 down vote accepted

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
}
share|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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.