Return to Snippet

Revision: 56621
at April 5, 2012 14:02 by FatFolderDesigner


Initial Code
// The Base Function
wp_redirect('http://www.urlofsite.com/path/to/location',301);

// In Use Example
add_action('template_redirect', 'redirect');
function redirect(){
	if($redirect){
		wp_redirect(get_bloginfo('url').'/wp-content/plugins/redirector/site/index.php',302);
		exit;
	}
}

Initial URL
http://www.fatfolderdesign.com/564/wordpress/redirecting-users-in-wordpress-with-wp_redirect

Initial Description
This needs to be run on an action, or at least I wanted able to get it to run outside of an action, I suggest template_redirect. More information at the link.

Initial Title
Wordpress Redirects with wp_redirect()

Initial Tags
redirect, plugin, wordpress

Initial Language
PHP