Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have been working around with adding stuff in user profile edit area. i am done with that but there is one thin i am unable to sort out.

What i am planning to do is to redirect a user to a custom page (custom member page) after they successfully edited their profile (wp-admin/profile.php) . In case of error they stay there. Help is appreciate :) thanks

share|improve this question

2 Answers 2

This is the function that you need:

add_action( 'profile_update', 'custom_profile_redirect', 12 );
function custom_profile_redirect() {
    wp_redirect( trailingslashit( home_url() ) );
    exit;
}

Just change the target of wp_redirect to whatever URL you want your users to go to. You can even add conditional logic to it if you only want this to happen for certain users, like the function below:

add_action( 'profile_update', 'custom_profile_redirect', 12 );
function custom_profile_redirect() {
    if ( current_user_can( 'subscriber' ) ) {
        wp_redirect( trailingslashit( home_url() ) );
        exit;
    }
}

Hope this helps! You can learn more about it from this tutorial I wrote.

share|improve this answer
    
Hi Thomas, I know how to add a textbox profile field but how can I add a textarea on profile.php ? Should I create a new question for you ? –  Xalloumokkelos Jun 28 '11 at 14:09
add_action('personal_options_update', 'redirect_me');
function redirect_me(){
  wp_redirect(home_url('/'));
  exit;
}
share|improve this answer
    
Hey, thx,, yes it is redirecting but it isn't saving or updating the changes . –  Ayaz Malik Jan 14 '11 at 1:55
    
I don't see any other hook there, so I guess the only way is to edit the .php file... –  onetrickpony Jan 14 '11 at 2:30
    
oh hmm k . thx :) –  Ayaz Malik Jan 14 '11 at 3:11

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.