Join

WooCommerce Redirect After Logout

Don't want to mess with code snippets? This is a feature of MyListing Pro.

Instructions

  1. Create a new PHP code snippet.
  2. Copy the contents of code snippet below.
  3. Paste the contents into your code snippet.
  4. Review any notes that I’ve provided.
  5. Save and enable the code snippet.
  6. Test.

Snippet

This code snippet allows website owners to send users to a custom URL after they log out. Adjust Line 6 as desired.

PHP
<?php

add_action( 'wp_logout', 'wc_redirect_after_logout' );

function wc_redirect_after_logout() {
	wp_safe_redirect( home_url( '/custom-url/' ) );
	exit;
}