Created
May 11, 2018 14:03
-
-
Save Quay3/542417322db680841b0c1e9fbe8a287c to your computer and use it in GitHub Desktop.
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 | |
/* | |
Plugin Name: Custom Redirect | |
*/ | |
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' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment