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 badges
Add a comment  | 

2 Answers 2

Reset to default 13

WordPress 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

本文标签: