Skip to content

Instantly share code, notes, and snippets.

@Quay3
Created May 11, 2018 14:03
Show Gist options
  • Save Quay3/542417322db680841b0c1e9fbe8a287c to your computer and use it in GitHub Desktop.
Save Quay3/542417322db680841b0c1e9fbe8a287c to your computer and use it in GitHub Desktop.
<?php
/*
Plugin Name: Custom Redirect
*/
function my_custom_redirect () {
global $post;
if ( is_page() || is_object( $post ) ) {
if ( $redirect = get_post_meta($post-&gt;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