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.