Hi Tim,
Do you have a working script that I could use to safely perform the redirect? Below is what I am considering trying but concerned on breaking the site.
Not sure if this older code could potentially perform the redirect function in the wp-includes/general-template.php:
add_filter( âlogin_urlâ, âmy_login_pageâ, 10, 2 );
function my_login_page( $login_url, $redirect ) { if(stristr($redirect,âadminâ)){ wp_safe_redirect(â/site_url/404.phpâ); }else{ return str_replace(âwp-login.phpâ,âcustom_url_stringâ,$login_url); } } add_action( âlogin_formâ, âreplace_login_submit_formâ,1); function replace_login_submit_form() { $your_content = ob_get_contents(); $your_content = str_replace(âwp-login.phpâ,âcustom_url_stringâ,$your_content); ob_get_clean(); echo $your_content; }
Or
add_filter( âlogin_urlâ, âmy_login_pageâ, 10, 3 );
function my_login_page( $login_url, $redirect, $force_reauth ) {
$login_page = home_url( â/my-login-page/â );
$login_url = add_query_arg( âredirect_toâ, $redirect, $login_page );
return $login_url;
}
Do I need to specify > âlogin_urlâ and > $login_url as mysite.com?
Also do I add one of the scripts above above or below my current script shown below?
function wp_logout_url($redirect = ââ) {
$args = array( âactionâ => âlogoutâ );
if ( !empty($redirect) ) {
$args[âredirect_toâ] = urlencode( $redirect );
}
$logout_url = add_query_arg($args, site_url(âwp-login.phpâ, âloginâ));
$logout_url = wp_nonce_url( $logout_url, âlog-outâ );
I am nervous of making a mistake. Thank you again for your time.