Created
October 4, 2018 15:55
-
-
Save hvsombrilla/d75180c2f70089d2ac7c8bedf726ef61 to your computer and use it in GitHub Desktop.
Redirect to External URL in External Products - Woocommerce
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function redirectExternalProduct() | |
{ | |
if (is_single() AND !empty(get_post_meta(get_the_ID(), '_product_url'))) { | |
wp_redirect(get_post_meta(get_the_ID(), '_product_url', true)); | |
exit; | |
} | |
} | |
add_action('wp', 'redirectExternalProduct'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment