This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php //<~ don't add me in | |
add_filter( 'wp_nav_menu_items', 'my_account_loginout_link', 10, 2 ); | |
/** | |
* Add WooCommerce My Account Login/Logout to Registered Menu | |
* | |
* @link https://support.woothemes.com/hc/en-us/articles/203106357-Add-Login-Logout-Links-To-The-Custom-Primary-Menu-Area | |
*/ | |
function my_account_loginout_link( $items, $args ) { | |
if (is_user_logged_in() && $args->theme_location == 'primary') { //change your theme registered menu name to suit |