My Account

WooCommerce Logout Redirect

WooCommerce custom page showing after logout


There are no pre-requisites in order for you to be able to implement this solution.

How To Implement This Solution?

Simply copy the pre-coded solution to your active theme’s functions.php or preferably the Code Snippets Plugin.

About This Solution

This guide shows you how you can redirect users to any page on your site when they logout instead of the default My Account login page. Simply enter the Post ID of the URL you wish to redirect users to when they logout. To get the post ID, simply edit that page and the URL will show you the integer ID. Alternatively, you can hover over the post in the backend editor where you “Quick Edit” posts and you’ll see the ID there too.

 * Snippet Name: WooCommerce Logout Redirect
 * Snippet Author:

add_action('wp_logout', 'ecommercehints_logout_redirect');
function ecommercehints_logout_redirect(){
    wp_safe_redirect( get_permalink( 121 ) );	// The Post ID to redirect users to when they logout

Snippet Benefits

  • Redirect your users to a custom page when they logout of their account

100 WooCommerce Conversion Rate Optimisation Tips

This field is for validation purposes and should be left unchanged.

Let’s collaborate!

Need to outsource WordPress development?

Join forces with UnlimitedWP for an outsourced white label web development service you can truly rely on.

First Timer Here?

Sign up to receive 20% off on your first month with us.