I'm using s2member pro and a custom theme. I'm trying to add a simple log in / log out link to my site's main navigation menu. I stumbled upon this following code which I added to my functions.php file:
add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2);
function add_login_logout_link($items, $args) {
ob_start();
wp_loginout('index.php');
$loginoutlink = ob_get_contents();
ob_end_clean();
$items .= '<li>'. $loginoutlink .'</li>';
return $items;
}
It successfully added a log in / log out link to my menu. However, it does not adhere to the same login redirect rules that the s2member pro login widget adheres to. Has anyone attempted this?