Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter( 'wp_nav_menu_items', 'wti_loginout_menu_link', 10, 2 );
- function wti_loginout_menu_link( $items, $args ) {
- if ($args->theme_location == 'primary') {
- if (is_user_logged_in()) {
- $items .= '<li><a href="'. wp_logout_url() .'">Log Out</a></li>';
- } else {
- $items .= '<li><a href="'. wp_login_url(get_permalink()) .'">Log In</a></li>';
- }
- }
- return $items;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement