Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress多个自定义查询字符串出现问题_Wordpress_Rewrite - Fatal编程技术网

Wordpress多个自定义查询字符串出现问题

Wordpress多个自定义查询字符串出现问题,wordpress,rewrite,Wordpress,Rewrite,我正在努力添加多个querystring,但它似乎不起作用。我发现一些代码似乎对其他人有效,但可能是我遗漏了一些东西 我想要像这样的东西: 到 然后我将下面的代码添加到functions.php文件中。不过,它似乎没有发挥应有的作用 这很有效。回显querystring可以毫无问题地获取这两个变量 但事实并非如此。我测试了查询字符串visisset(),但似乎没有设置/获取任何内容 任何帮助都将不胜感激 谢谢 正如我所料,当第二个参数未使用时,我缺少一条重写规则。答案是对我有用的代码:

我正在努力添加多个querystring,但它似乎不起作用。我发现一些代码似乎对其他人有效,但可能是我遗漏了一些东西

我想要像这样的东西:

然后我将下面的代码添加到
functions.php
文件中。不过,它似乎没有发挥应有的作用

这很有效。回显querystring可以毫无问题地获取这两个变量

但事实并非如此。我测试了查询字符串vis
isset()
,但似乎没有设置/获取任何内容

任何帮助都将不胜感激


谢谢

正如我所料,当第二个参数未使用时,我缺少一条重写规则。答案是对我有用的代码:

function add_rewrite_rules($aRules) {
  'board/(.*)/(.*)/?' => 'index.php?pagename=board&getyear=$matches[1]&getsometext2=$matches[2]',
  'board/(.*)/?' => 'index.php?pagename=leaderboard&getyear=$matches[1]');
  $aRules = $aNewRules + $aRules;
  return $aRules;
}
希望有人觉得这个有用

function add_rewrite_rules($aRules) {
  'board/(.*)/(.*)/?' => 'index.php?pagename=board&getyear=$matches[1]&getsometext2=$matches[2]',
  'board/(.*)/?' => 'index.php?pagename=leaderboard&getyear=$matches[1]');
  $aRules = $aNewRules + $aRules;
  return $aRules;
}