This page redirects to an external site: https://developer.wordpress.org/reference/functions/wp_redirect/
Languages: English • Italiano • 日本語 (Add your language)
Redirects the user to a specified absolute URI.
wp_redirect() does not exit automatically and should almost always be followed by exit. If you are going to use it in page template or any other page make sure to use the function before get_header().
<?php wp_redirect( $location, $status ); exit; ?>
<?php wp_redirect( home_url() ); exit; ?>
Redirects can also be external, and/or use a "Moved Permanently" code :
<?php wp_redirect( 'http://www.example.com', 301 ); exit; ?>
The code below redirects to the parent post URL which can be used to redirect attachment pages back to the parent.
<?php wp_redirect( get_permalink( $post->post_parent )); exit; ?>
The HTTP/1.1 status code 302 is a temporary redirect. If the page has moved permanently, use the HTTP status code 301.
wp_redirect() is a Pluggable Function
wp_redirect() is located in wp-includes/pluggable.php.