Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
add comment

1 Answer

WordPress 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.

share|improve this answer
    
Hello Jan and sorry for not answering sooner, I have been on a trip! Thanks a lot for your answer but I still have some doubts. do you work as freelance? –  antorome Apr 6 '11 at 21:52
    
@antorome: No problem, it is indeed complicated. You can find my contact info on my profile page. –  Jan Fabry Apr 7 '11 at 5:59
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.