Sometimes you may want to send users to a unique or custom URL after logging in through WooCommerce.
No need for additional plugins or complicated code.
Just add the following code to the custom functions area of your functions.php file.
// Custom redirect for users after logging in add_filter('woocommerce_login_redirect', 'wcs_login_redirect'); function wcs_login_redirect( $redirect ) { $redirect = 'http://google.com/'; return $redirect; }
It’s very easy to customise the above URL, either by entering a plain URL or using a WordPress function, like:
admin_url();
Or you could swap out the following number for the page ID you want to link to:
get_permalink( 25 );
How about after they log out? I’ve written about that too in this tutorial.
In addition, if you’d like to do the same but after a user registers, try the following:
// Custom redirect for users after logging in add_filter('woocommerce_registration_redirect', 'wcs_register_redirect'); function wcs_register_redirect( $redirect ) { $redirect = 'http://google.com/'; return $redirect; }
Views (102)
The following two tabs change content below.

Chris Mok
Senior Developer at GNA eMarketing
Core Contributor on the WordPress.org

Latest posts by Chris Mok (see all)
- WHM – Change account setup date manually - August 25, 2016
- Manually generate the notifications to who over disk quota - August 23, 2016
- Help Desk Management: What is Level 1, Level 2, and Level 3 Help Desk support? - July 27, 2016
- Find and delete files greater than a given size from the Linux command line - April 18, 2016
- How to change WordPress default email’s From name and address - April 15, 2016