Last active
October 7, 2021 14:06
-
-
Save itsHall/d9c70dc532174048e7f8da30fe9a1b39 to your computer and use it in GitHub Desktop.
Redirect CPT Page to Home
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 | |
//---------------------------// | |
// Redirect CPT Page to Home // | |
//---------------------------// | |
add_action( 'template_redirect', function() { | |
if ( is_singular('doctors') || is_singular('programs') ) { | |
global $post; | |
$redirectLink = get_home_url(); | |
wp_redirect( $redirectLink, 302 ); | |
exit; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment