Answers for "how to make a wordpress page redirect to another website"

PHP
5

redirect wordpress

add_action( 'template_redirect', 'redirect_to_other_page' );
function redirect_to_other_page() {
    if ( is_page( 143 ) ) {
	  
      wp_redirect( '"'.home_url().'/services/messenger/"', 301 );
      ///wp_redirect( 'example.com/page', 301 ); 
    exit;
    }
}
Posted by: Guest on April-12-2021
0

In wordpress, how to redirect after a comment back to the referring page?

add_filter('comment_post_redirect', 'redirect_after_comment');
function redirect_after_comment($location)
{
return $_SERVER["HTTP_REFERER"];
}
Posted by: Guest on November-09-2020

Code answers related to "how to make a wordpress page redirect to another website"

Browse Popular Code Answers by Language