Redirect User Profile to Custom Template Page

I work with Gravity Forms, and Gravity Forms User Registration a lot, so being able to redirect users to a custom template instead of a front end user profile (such as Theme My Login) would be preferred.

With Gravity Forms, I’m able to enable custom notifications based on the fields that are updated.

The below snippet will redirect all non-admins to the specified URL. Attach your Gravity Forms to the specified page, and use the User Registration Add-on to update user information.

// redirect user profile to specific page
add_action ('init' , 'prevent_profile_access');
 
function 	prevent_profile_access(){
   		if (current_user_can('manage_options')) return '';
		
   		if (strpos ($_SERVER ['REQUEST_URI'] , 'wp-admin/profile.php' )){
      		wp_redirect( home_url( '/members/profile/' ) ); // custom profile URL
 		 }
 
}

View the original code sourced here.

Leave a Reply

katherine as a flat graphic icon

About Me

I’m an African / Ojibwe First Nations Web Developer living in Winnipeg, Manitoba.

Visit the Tips and Blog to see what I’m working on.