In my application a user needs to 1stlogin and is then able to access the website.
There are 3 different user roles in use on my site
- administrator
- editor
- contributor
User can login from
http://example.com/wordpress/wp-login.php
No login from any theme template.
I have found this code, but it doesn't work
function my_login_redirect_contributors() {
if ( current_user_can('contributor') ){
return 'url-to-redirect-to';
}
}
add_filter('login_redirect', 'my_login_redirect_contributors');
Note: I do not want to use plugin like Peter's Login Redirect. I want to achieve it by customizing wp core code with a filter.