WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Difference between revisions of "Function Reference/wp redirect"

m (Added reference to glossary)
(Using Parameter template)
Line 4: Line 4:
   
 
== Parameters ==
 
== Parameters ==
+
{{Parameter|$location|string|The '''absolute''' URI which the user will be redirected to.}}
; <tt>$location</tt> : (''string'') The '''absolute''' URI which the user shall be redirected to.
 
   
 
== Usage ==
 
== Usage ==

Revision as of 02:41, 13 January 2008

Description

Redirects the user to a specified absolute URI.

Parameters

$location
(string) (required) The absolute URI which the user will be redirected to.
Default: None

Usage

 <?php wp_redirect($location); ?> 

Example

 <?php wp_redirect(get_option('siteurl') . '/wp-login.php'); ?> 

Redirects can also be external:

 <?php wp_redirect('<nowiki>http://www.example.com</nowiki>'); ?>