Add more than one query parameter onto wordpress url

As soon as someone clicks on an anchor tag in my website, I was planning to redirect to the same page containing the inf

As soon as someone clicks on an anchor tag in my website, I was planning to redirect to the same page containing the information added via two URL query parameters, and then access them with the $_GET superglobal, as it's usually done. I'm doing this in wordpress.

Now, I'm following exactly the instructions explained here /, meaning that I added the two parameters via the add_query_arg() wp function. The link is built perfectly, but the site is not recognized! (404 error produced). If I do exactly the same but with only one parameter (using the exact same syntax), it reloads the same page with the query parameter in the link, so with only parameter, wordpress recognizes the page perfectly. Anyone with the same problem ?? No comma or other syntax problems.

$previousMonth = date("m",mktime(0,0,0,$month-1,1,$year));
$previousYear = date("Y",mktime(0,0,0,$month-1,1,$year));
$previousLink = add_query_arg(
  array(
    'month' => $previousMonth,
    'year' => $previousYear
    )
  );
$calendar .= "<div class='move-dates'><a class='move-calendar' href=".$previousLink.">&#8678 Previous Month</a></div>";

This does not work (404 Error page, however with both query parameters correctly displayed in the correct URL; ?month=valuemonth&year=valueyear).. However, interestingly, this works:

$previousMonth = date("m",mktime(0,0,0,$month-1,1,$year));
$previousYear = date("Y",mktime(0,0,0,$month-1,1,$year));
$previousLink = add_query_arg(
  array(
    'month' => $previousMonth,
    'year' => 'hi'
    )
  );
$calendar .= "<div class='move-dates'><a class='move-calendar' href=".$previousLink.">&#8678 Previous Month</a></div>";

(only modification = year query parameter changed to string 'hi').

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744688461a4588063.html

相关推荐

  • Add more than one query parameter onto wordpress url

    As soon as someone clicks on an anchor tag in my website, I was planning to redirect to the same page containing the inf

    10天前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信