无法在Wordpress中传递GET变量

时间:2013-01-27 22:15:44

标签: php mysql wordpress url variables

我一直在搜索几个小时,但无法找到解决问题的方法。似乎Wordpress不允许我在我的URL中传递变量。我目前有:

    <?php
$reg_step = $_GET['s'];
/*
Template Name: Order Register Page
*/ 

include('db_connect.php');
include('order_functions.php');
if($reg_step == "1"){
?> <div id="f_login">
<?php
//login form    
if(isset($_GET['error'])) { 
echo 'Error Logging In! Please provide correct email and password.';
}
 if(isset($_GET['register'])) { 
  echo 'Thanks for registering. You can now login.';
}
?>
 <form action="reg2.php?s=2" method="post" name="login_form">

  <label for="email">Email:</label> <input type="text" name="email" /> <div class="clear">        </div>
 <label for="password">Password:</label> <input type="password" name="password"      id="password"/><div class="clear"></div>
  <div> <input type="submit" value="Login" /></div>
  <div class="clear"></div>
</form><br />
<center><a href="reg2.php?s=4">Sign-up for an account</a><br />
    <a href="reg2.php?s=6">Reset your password.</a></center>
</div>
<?php
}else if ($reg_step == "2"){
include('db_connect.php');

我希望能够检索三个变量:&#39; s&#39;,&#39;错误,然后注册。但是,我尝试了几个插件,但它们似乎无法正常工作。我目前正在使用:

add_filter('query_vars', 'param_queryvars');
function param_queryvars( $qvars )
{
$qvars[] = 's';
return $qvars;
}

用这个来调用变量:

global $wp_query;
if (isset($wp_query->query_vars['s']))
{
$reg_step =  $wp_query->query_vars['s'];
}

0 个答案:

没有答案