Created
July 1, 2025 05:46
-
-
Save arfinmilondev/ea69ceec01724ef2ae83f32465057b53 to your computer and use it in GitHub Desktop.
Redirect affiliate users to the Affiliate area page when login through EDD Login form
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
| <?php | |
| //if the user is an affiliate. Based on that, you can redirect them either to the Affiliate Area or the EDD Customer Dashboard. | |
| if ( ! function_exists( 'custom_edd_login_redirect' ) ) { | |
| function custom_edd_login_redirect( $redirect_to, $user_id ) { | |
| if ( function_exists( 'affwp_is_affiliate' ) && affwp_is_affiliate( $user_id ) ) { | |
| return site_url( '/affiliate-area/' ); | |
| } | |
| return $redirect_to; | |
| } | |
| add_filter( 'edd_login_redirect', 'custom_edd_login_redirect', 10, 2 ); | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment