Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#20798 closed defect (bug) (invalid)

Custom Taxonomies and Rewrite

Reported by: sumitp Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.3.2
Component: General Keywords: close
Focuses: Cc:


Seems like a wierd issue. I have 2 custom taxonomies on my system, say tax1 and tax2

When I use below url it works fine.

Now, I added a htaccess rule to make this URL SEOable as

When I use the rule as below, the page does not give results
RewriteRule (.*)-at-(.*)$ /?tax1=$1&tax2=$2 [L]

While, when I add R=302, the rule works fine, but the URL changes, which I do not intend to do.

On further checks, I found that "Query Multiple Taxonomies" generates the page title as
Categories: ; Tax1: Tax1 A; Tax2: Tax2A, Tax2B
which, indicates addition of "Category" filter into the query, hence no results.

Normal title, when page works is as below
Tax1: Tax1 A; Tax2: Tax2A, Tax2B

I am not sure of the resolution for this though.

Change History (3)

comment:1 @ipstenu3 years ago

  • Keywords close added

It should probably be [R=301,L]

But this isn't a bug in WP. You should post this one in the support forums :)

comment:2 @sumitp3 years ago


Thank you for the reply. As I said, it works with R=301, but that changes the URL which I do not want. But it does not work without R=301, though the rule is the same.

The reason for adding this as a bug is that, using QMT, I get to know that it is even applying category = '' (blank) for the posts retrieval, apart from the custom taxonomies.

When 301 is applies, it properly applies only custom taxonomies in the posts query.

Hope this helps to understand the issue.

Last edited 3 years ago by SergeyBiryukov (previous) (diff)

comment:3 @dd323 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

This isn't a Bug, it's due to the way you're doing the rewriting, Unfortunately I'm not good enough at mod_rewrite to suggest an alternative.

WordPress is interprating the request in 2 ways, It's processing the GET variables (from your rewrite rule) and also from the REQUEST_URI (ie. WordPress's internal url rewriting functionality)

The actual request WordPress see's is:


Since your permalink rules are most likely %category%/%postname%/ or similar, WordPress is interpreting the path in the URL as a category. This isn't a bug, it's just the way that the rewrite rules in WordPress work.. They don't work well with mod_rewrite rules that also hit WordPress.

The best way to achieve what you want, would be to use WordPress's internal url rewriting, WP_Rewrite instead.

Note: See TracTickets for help on using tickets.