stefanlesik Posted April 7, 2014 Share Posted April 7, 2014 (edited) 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 } ?> Edited April 7, 2014 by stefanlesik Quote Link to comment https://forums.phpfreaks.com/topic/287578-wp-redirect-on-id-query-string/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.