/* Put this in a separate plugin or within the existing redirect plugin */ function add_referrer_to_login_form() { if ( !isset( $_REQUEST['redirect_to'] ) ) { print ''; } } add_action('login_form', 'add_referrer_to_login_form'); /* Then, put this in the function that redirects, such as redirect_to_front_page */ // If there's been a posted redirect, perhaps redirect there? if ( !empty ( $_POST['redirect_to_referrer'] ) ) { return $_POST['redirect_to_referrer']; }