admin管理员组文章数量:1334412
I have been reading dozens of posts and honestly, I have many doubts on how this work. Furthermore, I think that with WP3.1 more issues have been added here because I am having even more problems now than before.
The point is that I am using the same slug for different kind of taxonomies and posts. Let's use loans as the slug for my problem.
Until now, I had the page /loans/ and also the category /loans/ and subs /loans/fixed-rate/ and /loans/variable-rate/. In /loans/ I displayed the page where I had a custom template showing different things and in /loans/subcategories/ I had archives for the posts in that given category. Furthermore, my posts had the strucutre /%postname%/.
Now, in WP3.1, in /loans/, I see the archive of all the posts in /loans/ and its children and I have been forced to create a category template "copying" what I had in the page before.
I want now, taking advantage of WP3.1 features, to create a custom post called also /loans/ so I can define a new template for these posts. I also want to create a new taxonomy called /loans/ (instead of the category) being non-hierarchical so I can have dozens of subcategories /loans/loans-bank-X/, loans/loans-X-rate/, /loans/loans-X-years/ :
- /loans/ -> Page with a custom template
- /loans/fixed-rate/, /loans/bank-of-america/, /loans/30-years/ -> Taxonomy
- /loans/30-years-fixed-rate-loan-of-bank-of-america-review/ -> Custom Post with a review of the product
¿Is there a way of doing this correctly?
I had read before thag pages had priority over categories but not now in 3.1. I believe it would also be nice if someone write down the current priority of these slugs.
This can be solved using different slugs for the taxonomies, etc but from a SEO and UX point of view it is much better to do it with the same slug.
Thanks a lot and regards.
I have been reading dozens of posts and honestly, I have many doubts on how this work. Furthermore, I think that with WP3.1 more issues have been added here because I am having even more problems now than before.
The point is that I am using the same slug for different kind of taxonomies and posts. Let's use loans as the slug for my problem.
Until now, I had the page /loans/ and also the category /loans/ and subs /loans/fixed-rate/ and /loans/variable-rate/. In /loans/ I displayed the page where I had a custom template showing different things and in /loans/subcategories/ I had archives for the posts in that given category. Furthermore, my posts had the strucutre /%postname%/.
Now, in WP3.1, in /loans/, I see the archive of all the posts in /loans/ and its children and I have been forced to create a category template "copying" what I had in the page before.
I want now, taking advantage of WP3.1 features, to create a custom post called also /loans/ so I can define a new template for these posts. I also want to create a new taxonomy called /loans/ (instead of the category) being non-hierarchical so I can have dozens of subcategories /loans/loans-bank-X/, loans/loans-X-rate/, /loans/loans-X-years/ :
- /loans/ -> Page with a custom template
- /loans/fixed-rate/, /loans/bank-of-america/, /loans/30-years/ -> Taxonomy
- /loans/30-years-fixed-rate-loan-of-bank-of-america-review/ -> Custom Post with a review of the product
¿Is there a way of doing this correctly?
I had read before thag pages had priority over categories but not now in 3.1. I believe it would also be nice if someone write down the current priority of these slugs.
This can be solved using different slugs for the taxonomies, etc but from a SEO and UX point of view it is much better to do it with the same slug.
Thanks a lot and regards.
Share Improve this question asked Mar 23, 2011 at 17:45 antoromeantorome 491 silver badge6 bronze badges1 Answer
Reset to default 4WordPress parses incoming URLs with a list of regular expressions, the rewrite rules. The first regex that matches the URL "wins", and determines what kind of query will be executed. You can see the rewrite rules and play with different URLs with my Rewrite analyzer plugin.
Whether or not pages take priority over other rules depends on your permalink structure. If it contains %postname%
, %category%
, %tag%
, or %author%
as the first permastruct, the rewrite engine will generate verbose page rules, where each page gets a specific rule at the top of the list instead of a catch-all rule at the end. This can explain the difference between the two sites.
The WP_Rewrite::rewrite_rules()
function that generates the rules has many different filters. You can hook into one of them to modify the array, so that the most important rules for you are at the top. You can find many questions on this site with examples of how to modify these rules.
本文标签:
版权声明:本文标题:taxonomy - Priority for Categories, Tags, Taxonomies, Posts, Pages and Custom Posts with same url 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742349215a2458145.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论