4 thoughts on “How to display WooCommerce my account page link to logged in users – or login / register link if not logged in”

  1. Hi Robin, this is excellent. What is needed to add a ‘Log Out’ link following account.

    So the logged-in user’s line is: Account | Log Out
    The guest’s user’s line is: Log In | Register

    Many thanks,

    • Hi Kevin,

      Should be do-able using something like:

      wp_logout_url( get_permalink( wc_get_page_id( 'myaccount' ) ) )

      For the link itself. The logic behind it will be similar to the other link.

      I’ll put this on the list to make a quick tutorial… this can take a while though 🙂

  2. Kindly tell me where to put this code snippet in. I am trying to put it in functions.php but its giving a syntax error that unexpected < at the end of the file


Leave a comment

No links of any kind allowed in comments - if you add any links, your comment will automatically be deleted.