WordPress Affiliate Manager

Affiliates Management Plugin for WordPress

  • Home
  • Features
    • Screen Shots
  • Download
  • Documentation
  • Addons
  • Support
    • Support Forum
    • Forum Login
    • Forum Registration
    • Contact
    • Premium Addon/Plugin Support
You are here: Home

spamis

  • Profile
  • Topics Started
  • Replies Created
  • Engagements
  • Favorites

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • March 16, 2021 at 8:00 pm in reply to: Affiliate Login page redirects to wp-admin login page #7237
    spamis
    Participant

    I am using WP Affiliate Manager and had this same problem – failed login defaulting to the WordPress login page. I found this snippet online and it worked for me with my theme’s (Divi) login page. With failed login it now stays on the same login page. The only thing I can’t get to work is there is no error message telling the user that the login failed. Anyway, you need to put the snippet it in your theme’s function.php file which is hopefully in a child theme folder. I hope this works for you.

    function wpcc_front_end_login_fail( $username ) {
    $referrer = $_SERVER[‘HTTP_REFERER’];
    if ( !empty( $referrer ) && !strstr( $referrer,’wp-login’ ) && !strstr( $referrer,’wp-admin’ ) ) {
    $referrer = esc_url( remove_query_arg( ‘login’, $referrer ) );
    wp_redirect( $referrer . ‘?login=failed’ );
    exit;
    }
    }
    add_action( ‘wp_login_failed’, ‘wpcc_front_end_login_fail’ );

    function custom_authenticate_wpcc( $user, $username, $password ) {
    if ( is_wp_error( $user ) && isset( $_SERVER[ ‘HTTP_REFERER’ ] ) && !strpos( $_SERVER[ ‘HTTP_REFERER’ ], ‘wp-admin’ ) && !strpos( $_SERVER[ ‘HTTP_REFERER’ ], ‘wp-login.php’ ) ) {
    $referrer = $_SERVER[ ‘HTTP_REFERER’ ];
    foreach ( $user->errors as $key => $error ) {
    if ( in_array( $key, array( ’empty_password’, ’empty_username’) ) ) {
    unset( $user->errors[ $key ] );
    $user->errors[ ‘custom_’.$key ] = $error;
    }
    }
    }

    return $user;
    }
    add_filter( ‘authenticate’, ‘custom_authenticate_wpcc’, 31, 3);

  • Author
    Posts
Viewing 1 post (of 1 total)

Featured Addons

  • WooCommerce Coupon Tracking
  • WooCommerce Product Specific Commission

Copyright © 2026 | WordPress Affiliate Manager | Privacy Policy