Skip to content

Instantly share code, notes, and snippets.

@DanielSantoro
Last active December 5, 2017 15:42
Show Gist options
  • Save DanielSantoro/248985e637abeb2a8bbc124360671777 to your computer and use it in GitHub Desktop.
Save DanielSantoro/248985e637abeb2a8bbc124360671777 to your computer and use it in GitHub Desktop.
Redirect Thank You Page
<?php
/**
* Redirects Thank You page after checkout in WooCommerce
*/
add_action( 'template_redirect', 'wc_redirect_post_checkout' );
function wc_redirect_post_checkout() {
global $wp;
if ( is_checkout() && ! empty( $wp->query_vars['order-received'] ) ) {
wp_redirect( 'http://example.com' );
exit;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment