Jump to content

WP Redirect on id query string


stefanlesik

Recommended Posts

Hi - I'm trying to setup a redirect based on query string eg ?id=1 or ?id=2. I can't get the wp_redirect( $iosurl[$_GET['id']], 302 ); exit; to print the array value. Any ideas? Thanks

<?php 
  global $iosurl;
  $iosurl = array(
'1' => 'http://domain1.uk/',
'2' => 'http://domain2.uk/'
);

if(array_key_exists($_GET['id'], $iosurl))
      { ?>

     <?php wp_redirect( $iosurl[$_GET['id']], 302 ); exit; ?>
	
   <?php } ?>
Link to comment
https://forums.phpfreaks.com/topic/287578-wp-redirect-on-id-query-string/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.