Point my menu Log in/Log out link to my custom pages
-
I am using a piece of code in my theme’s function file to add a Log in/Log out link to my site’s primary nav menu. Currently it points to the WordPress default. Need some help modifying it so that it points to my new custom Login page. Hoping the author can help.. (pretty please)
// in both cases, this code will add WP's built-in Login/Logout link to the last position in the menu // with acknowledgement to voodoopress.com // https://voodoopress.com/add-a-login-logout-link-to-only-one-specific-menu/ //ADD LOGIN LINK TO PRIMARY MENU add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2); function add_login_logout_link($items, $args) { if( $args->theme_location == 'primary' ) { $transmitredir = htmlspecialchars($_SERVER['REQUEST_URI']); $loginoutlink = wp_loginout($transmitredir, false); return $items . "<li> $loginoutlink </li>"; } return $items; }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Point my menu Log in/Log out link to my custom pages’ is closed to new replies.