Had to make some modifications to my custom functions.. and now I have everything redirecting correctly using this plugin.. So.. my ENTIRE fix altogether now..
STEP ONE:
Changed line 137 of wp-content/plugins/wp-login/wp-login.php as follows:
if($_SERVER[‘SCRIPT_NAME’]==”<?php home_url(‘/’); ?>wp-login.php”):
Changed line 586 of wp-content/plugins/wp-login/wp-login.php as follows:
<?php home_url(‘/’); ?>wp-login.php” target=”_blank” class=”btn”>View Your Login Page
This now correctly calls the blog homepage regardless of whether or not WordPress is installed in the site root or in a subfolder in the root.
STEP TWO
Add the following to your theme’s functions.php file.
add_action('init','possibly_redirect');
function possibly_redirect(){
global $pagenow;
if(!is_user_logged_in() && ( 'wp-login.php' == $pagenow )) {
wp_redirect('https://www.mysite.com/myblog/login'); // modify this as you wish
exit();
}
}
add_filter('logout_url', 'custom_logout_home', 10, 2);
function custom_logout_home($logouturl, $redir)
{
$redir = get_option('siteurl');
return $logouturl . '&redirect_to=' . urlencode($redir);
}
add_filter('login_redirect', '_catch_login_error', 10, 3);
function _catch_login_error($redir1, $redir2, $wperr_user)
{
if(!is_wp_error($wperr_user) || !$wperr_user->get_error_code()) return $redir1;
switch($wperr_user->get_error_code())
{
case 'incorrect_password':
case 'empty_password':
case 'invalid_username':
default:
wp_redirect('/myblog/login'); // modify this as you wish
}
return $redir1;
}
These custom functions do the following:
=======================================================================
It’s not a perfect solution, but these changes do make this plugin workable now.. I may do some more picking to figure out how to show the correct login state when accessing the login page after you are already logged in. (Currently the admin toolbar is your only hint that you are logged in)
My posts on the author’s blog regarding this issue have ALL been removed.. **shrug** So I will continue to post my updates here on the WordPress forum in case anyone using this plugin has the same issue. This way they can try my workaround until the author updates this plugin..