admin管理员组文章数量:1426295
For example I have 20 pages on a site. one of them is called bacon another called eggs. on the same site...lets say breakfast
I have the permalinks set up properly and have used them successfully on all pages, including Eggs by way of this: www.breakfast/eggs?cooked=scrambled. This works 100% as it should.
However, on a different page of Breakfast called sausage...this, does not work. www.breakfast/sausage?type=spicy
this is causes a 404 error. I don't see why it would as it's the same format. I have verified that the page exists in my pages directory in WP-admin.
If I strip away the GET variable the page works. Google is not helping me. Anyone have a similar experience?
For example I have 20 pages on a site. one of them is called bacon another called eggs. on the same site...lets say breakfast
I have the permalinks set up properly and have used them successfully on all pages, including Eggs by way of this: www.breakfast/eggs?cooked=scrambled. This works 100% as it should.
However, on a different page of Breakfast called sausage...this, does not work. www.breakfast/sausage?type=spicy
this is causes a 404 error. I don't see why it would as it's the same format. I have verified that the page exists in my pages directory in WP-admin.
If I strip away the GET variable the page works. Google is not helping me. Anyone have a similar experience?
Share Improve this question asked Aug 20, 2011 at 23:33 wooWoowoowooWoowoo 531 silver badge4 bronze badges2 Answers
Reset to default 13WordPress has a list of reserved terms that you cannot use for taxonomies. From your question, I gather that "cooked" is a taxonomy that applies to eggs and "type" is a taxonomy that applies to sausage. Unfortunately, "type" is a reserved term in WordPress, so it interprets your query string differently than you expect.
The full list of reserved terms is available in the Codex. Just use a different term ... maybe "sausage-type" ... for your taxonomy and you should be in the clear.
I was seeing inconsistent behavior with query parameters until I registered the parameter with Wordpress, like this:
function add_query_vars_filter( $vars ) {
$vars[] = "cooked";
return $vars;
}
add_filter( 'query_vars', 'add_query_vars_filter' );
See more here: get_query_var in Codex
本文标签:
版权声明:本文标题:php - Why would a GET variable one one page of a site cause a 404 error when a GET variable works on another page of a site? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745367475a2655584.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论