Last active
August 30, 2023 14:30
-
-
Save raftaar1191/29ef41f729007db46120962bbffdec94 to your computer and use it in GitHub Desktop.
Redirect user to cart page when they login
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* WordPress function for redirecting users on login based on user role | |
*/ | |
function awp_login_redirect_callback( $url, $request, $user ) { | |
/* | |
* Add your custom url | |
*/ | |
$url = home_url( '/cart/' ); | |
return $url; | |
} | |
add_filter( 'login_redirect', 'awp_login_redirect_callback', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment