• Resolved Kojote

    (@lunchglaz)


    I’m protecting the wp-login.php and wp-admin.php with basic authentication setup in .htaccess

    When woocommerce shop customers go to the my account page and click on the logout button they would have to enter the htpassword which of course is not available to them.
    The logout only works when I deactivate the protection of wp-login.php.
    Is there a way to have wp-login.php protected AND a customer can logout?

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @lunchglaz

    The issue you’re experiencing is because WordPress uses the wp-login.php file to handle both the login and logout processes. Protecting this file with basic authentication also affects the logout process.

    However, you can work around this issue using a custom logout URL instead of the default one. Here’s an example:

    function custom_logout_page() {
    wp_redirect(home_url());
    exit;
    }
    add_action('wp_logout','custom_logout_page');

    Please note that writing or providing custom code is not within the scope of our support policy. If you are still having problems, we recommend asking development questions on the #developers channel of 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 the job done.

    Thread Starter Kojote

    (@lunchglaz)

    Hi Shameem, many thanks for reply. Paste the code but it works only when there is no protect wp-login. When its protected you have to enter the htpassword again when logout.

    Plugin Support Rajesh K. (woo-hc)

    (@rajeshml)

    Hello @lunchglaz,

    As you were informed earlier by my colleague, you can visit the?WooCommerce Facebook group?or the?#developers?channel of the?WooCommerce Community Slack for further insights on this.

    Please let us know if there’s anything else we can do to help or if you have any questions.

    Thanks!

    Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @lunchglaz

    We’ve not heard back from you in a while, so I’m marking this thread as resolved. Hopefully, you were able to find a solution to your problem!

    If you have further questions, please feel free to open a new topic.

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘customer logout while havin wp-login protected’ is closed to new replies.