guillermorangel
9/25/2014 - 6:59 PM

redirect a page to another page wether form internal or external incoming visit

redirect a page to another page wether form internal or external incoming visit

<?php
function my_custom_redirect () {
    global $post;
    
    if ( is_page() || is_object( $post ) ) {
        if ( $redirect = get_post_meta($post->ID, 'redirect', true ) ) {
            wp_redirect( $redirect );
            exit;
        }
    }
} add_action( 'get_header', 'my_custom_redirect' );
?>