Created
June 14, 2019 13:36
-
-
Save dparker1005/03745f92a94a768ce4bbef4c8c61a1b4 to your computer and use it in GitHub Desktop.
Prevents wp_redirect to redirect to a specified page.
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 | |
/** | |
* Disable Redirection to Specific Page | |
*/ | |
function my_wp_redirect($location) { | |
// TODO: Change '10' to the page id that should not be redirected to | |
$page_id = 10; | |
if($location == get_the_permalink( $page_id ) ) { | |
$location = false; | |
} | |
return $location; | |
} | |
add_filter('wp_redirect', 'my_wp_redirect'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment