Now a days many Websites and Web application are using WordPress as their back-end. With increasing users of WordPress requires many more functionality to implement. Many Web Application / Websites requires to redirect users based on User’s role to particular or custom page.

Today Here I will let you know how can we implement to redirect user by user’s role in your WordPress Website. We will use hook “wp_login” and add one function to check current user role and then based on role we will redirect the user to predefined page (Custom Page).

To implement this you need to create one plugin and add below code to that

exit is used after wp-redirect so that it will not be overridden.

Please add your comment and queries below.