-
-
Save brentini/265177828517500871e1a93dded42e7a to your computer and use it in GitHub Desktop.
WordPress - Redirect a page using a filter #wordpress
This file contains hidden or 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
//Redirect a page using a filter | |
add_filter('get_the_permalink','my_permalink_redirect'); | |
function my_permalink_redirect($permalink) { | |
global $post; | |
if ($post->ID == your_post_id_here) { //Page ID you want to redirect | |
$permalink = 'http://new-url.com/pagename'; //Redirect destination page | |
} | |
return $permalink; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment