I have this code to create a Login/Logout button in the top right header.
add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2);
function add_login_logout_link($items, $args) {
ob_start();
if ( is_user_logged_in() ) {
wp_loginout('index.php');
} else {
wp_loginout( get_permalink( get_page_by_title( 'La mia pagina' ) ) );
}
$loginoutlink = ob_get_contents();
ob_end_clean();
$items .= '<li>'. $loginoutlink .'</li>';
return $items;
}
It works perfectly but when I click on Login it takes me to the wp-login.php with a redirect to ‘La mia pagina’.
I’d like it to take me to the new login page I created (title “login” es. https://website.com/login).
I cannot see where to apply these changes. Thanks for helping!
Add a filter to
login_url
: