Canonical Rewrite Misinterprets Some Queries
|Reported by:||filosofo||Owned by:||markjaquith|
Here's how to see the problem:
- Let's say you have a category named "fun" that has category id of 15
- Let's say you have a post under category "fun" for January 22, 2008
- Your permalink structure is /%category%/%year%/%monthnum%/%day%/%postname%/
If you request http://www.example.com/fun/2008/01/22/ then you get (as expected) an archive of all the posts categorized under "fun" on January 22, 2008.
You would expect to get the same thing for http://www.example.com/?year=2008&monthnum=1&day=22&cat=15, and if you were using default (i.e. no) permalinks, that is what you get with that request. You would also expect canonical redirect to send a request for http://www.example.com/?year=2008&monthnum=1&day=22&cat=15 to http://www.example.com/fun/2008/01/22/.
Instead, canonical redirect takes http://www.example.com/?year=2008&monthnum=1&day=22&cat=15, ignores the cat query arg, and redirects to http://www.example.com/2008/01/22/
The general problem is that canonical redirect doesn't do anything with the main permalinks setting. My patch creates a new function, get_permalink_from_query, which attempts to generate a permalink from the wp_query query vars, using the main permalinks setting. If it can't, it just returns false.
The patch also has canonical_redirect attempt to use this function first; if it fails, it goes on to try the existing permalink-generation methods.
Change History (9)
- Component changed from General to Canonical
- Owner changed from anonymous to markjaquith
- Keywords needs-patch added; has-patch removed
- Milestone changed from 2.9 to Future Release
- Type changed from defect (bug) to enhancement