Created
August 16, 2018 14:22
-
-
Save davidchc/0bdf9339f164be7fb2f5dab5c339b579 to your computer and use it in GitHub Desktop.
redirecionar para uma página definida pelo custom field
This file contains 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 | |
add_action('template_redirect', 'redirect_custom_field'); | |
function redirect_custom_field() { | |
global $post; | |
if($url = get_meta_post($post->ID, 'url_redirect', true)) { | |
wp_redirect($url); | |
exit; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment