Posted By

FatFolderDesigner on 04/05/12


Tagged

redirect plugin wordpress


Versions (?)

Wordpress Redirects with wp_redirect()


 / Published in: PHP
 

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

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.

  1. // The Base Function
  2. wp_redirect('http://www.urlofsite.com/path/to/location',301);
  3.  
  4. // In Use Example
  5. add_action('template_redirect', 'redirect');
  6. function redirect(){
  7. if($redirect){
  8. wp_redirect(get_bloginfo('url').'/wp-content/plugins/redirector/site/index.php',302);
  9. }
  10. }

Report this snippet  

You need to login to post a comment.