Hi, can some one tell me what the last line of code does: add_filter( ‘login_redirect’, ‘redirect_user_to’, 10, 3 );
<?php
// add this to the bottom of the functions.php file in yourt theme directory
function redirect_user_to( $redirect_to, $user ) {
global $user;
if ( $user->user_login == 'member' ) {
$redirect_to = '/'; // redirect to home page
return $redirect_to;
}
return $redirect_to;
}
add_filter( 'login_redirect', 'redirect_user_to', 10, 3 );
?>
add_filter is built in function of wordpress which is used to add Hooks . In simple word above code will invoke method redirect_user_to once user login and redirect to next URL happen. From the code of redirect_user_to it seems that it check if current logged in user is member then redirect it to home page or else redirect to page from which he was initially redirected to Login page. Hope this helps you.