Home » Blog » How to add a login and logout menu tab for your WooCommerce enabled DIVI theme

Adding a log in and log out button for a DIVI Woocommerce enabled theme has not been easy to search for a solution.

There’s seems to be no tutorial for it. Well, I have found one but it proves to be outdated or it’s not working on a DIVI WordPress theme. And I found another generic code for creating a log in and log out button but it’s a general one and not intended for Woo commerce My accounts.

I did a trial and error kinda thing! And after several searches and attempt to make my own, I use the code I found from a website. I just omitted 1 word. When I tested it, it redirect me to Woo commerce’s My account dashboard as soon as I logged in.

So here’s the code the found:

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; }

And this is the “word” I omitted -> index.php

And with that updated code, My customers can now log into my Internet Radio Cast on VPS website and immediately redirected to their My account page.

Share This

Share this post with your friends!