I have a Wordpress site with WooCommerce. I would like to add a Logout option to the Menu that logs out the user without asking for confirmation.
So I included a menu custom link with as URL: /my-account/customer-logout/?_wpnonce=3d7c353c19&redirect_to=http%3A%2F%2Fwww.example.com
. However, the nonce changes every time, so it will still ask for confirmation to log out...
This post shares something about how to get rid of the confirmation request with php. But I'm not familiar with php. How should I use this in the URL field of the custom link? That is, how can I populate the custom url with the dynamic nonce?
wp_logout_url()
is a PHP method, you need to familiarize yourself with PHP, find a plugin that solves this, or hire someone to do it for you.