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