Redirects the user to a specified absolute URI.
wp_redirect() does not exit automatically and should almost always be followed by
<?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