• Resolved monoor

    (@monoor)


    I want the user to return to the current page after logout.

    According to the documentation, I created the following code:

    $current_url = esc_url( home_url( $_SERVER['REQUEST_URI'] ) );
    <a href="<?php echo esc_url( wc_logout_url( $current_url ) ); ?>">logout</a>

    And this code created a link like this: https://site.com/product/hi/customer-logout/?_wpnonce=03350da55b

    But by clicking on it, the user is not logged out of the site and goes to the 404 page!

    I think this function has a bug.

Viewing 1 replies (of 1 total)
  • Plugin Support Rajesh K. (woo-hc)

    (@rajeshml)

    Hello @monoor,

    Thank you for reaching out to WooCommerce Support.

    For your specific need, you could consider using an extension like Redirect After Login, Registration, and Logout for WooCommerce, which allows you to redirect users to custom URLs such as “home,” “offers,” “catalog,” the previous page, or any external link after logging out. This extension is supported by us and you have a 30-day money-back guarantee to test it. 

    For reference, this particular forum is meant for general support with the core functionality of WooPayments itself. For development and custom coding questions, it’s best to ask for insight related to those on either the WooCommerce Advanced Facebook group or the WooCommerce Community Slack. Many of our developers hang out there and will be able to offer insights into your question. You can also seek help from the following:

    I wish I could help more, but hopefully, this gets you going in the right direction to get some further insight/information.

    Thanks!

Viewing 1 replies (of 1 total)

The topic ‘wc_logout_url() problem’ is closed to new replies.