Wordpress log out using URL and redirect to specify page


Staff member
I have one Wordpress installation . i need to log out the user without any indication user is coming from particular URL.Is it possible?

My code:

if($_GET['logout'] == 1)
 $redirect_to = current_page_url(); 
window.location.href="<?php echo wp_logout_url( $redirect_to ); ?>";

I am using above code in my header.php . When the user click particular link with log out parameter value is 1. I need to log out the user without any log out confirmation.

I tried with the above code but its asking the following Confirmation.is it possible to avoid this confirmation.

"You are attempting to log out of Learn

Do you really want to log out?"

My requesting URL is like this


I need to log out the user without confirmation and redirect to redirect parameter value URL.Is it possible?