Opened 16 years ago
Closed 14 years ago
#6516 closed enhancement (fixed)
canonical redirect doesn't redirect ?name=slug
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 2.9 | Priority: | normal |
Severity: | major | Version: | 2.5 |
Component: | Canonical | Keywords: | needs-patch |
Focuses: | Cc: |
Description
domain.com?name=test doesn't seem to be redirecting to domain.com/2008/03/31/test/
Attachments (1)
Change History (17)
#2
@
16 years ago
I believe that'd be the expected result, at least with the 2.5 branch.
If you were to try domain.com/test it would indeed redirect as expected.
AFAIK, It ignores query vars which it doesnt know about. If you were to access domain.com?p=<post id> then it'd also redirect.
#3
@
16 years ago
mm, aren't name and pagename (and several others) built-in query vars for WP? If WP cannot reliably redirect things other than ?p=ID, it's really not worth calling this a canonical permalink feature (or whatever it's called). I'd hate to have to reinstall permalink redirect... :-|
#4
@
16 years ago
- Milestone changed from 2.5.1 to 2.7
- Summary changed from canonical redirect broken to canonical redirect doesn't redirect ?name=slug
- Type changed from defect to enhancement
#6
@
15 years ago
- Component changed from Optimization to Canonical
- Keywords has-patch needs-testing added
- Milestone changed from 2.9 to 2.8
- Owner changed from anonymous to markjaquith
attachment 6516.diff added.
- Redirects ?name and ?pagename to their permalinks
- WP_Query changes:
- supports querying based on 'pagename' for pages which are not a static front page
if ( !empty($reqpage) )
was added to prevent querying for page_id == 0, which happens when pagename is a slug & a the page is a subpage (in that case, get_page_by_path() will fail)if ('' != $q['name'])
block was moved after page/attachment code to reduce duplicate code
#7
@
15 years ago
Hmm.. Those changes to WP_Query may've been in the wrong thinking, Page slugs are not unique (as is with attachments/posts)
#9
@
14 years ago
is_single() and is_page() mean we requested a single object. Can we not use get_queried_object_id() and pass that to get_permalink()?
#10
@
14 years ago
Imo, we should close this one, and open a grand ticket: Enforce permalink history across the board.
#11
follow-up:
↓ 12
@
14 years ago
Can we not use get_queried_object_id() and pass that to get_permalink()?
Yes, Yes we can. (Except that i'm not aware of the usage of function such as those :))
#12
in reply to:
↑ 11
@
14 years ago
Replying to DD32:
Can we not use get_queried_object_id() and pass that to get_permalink()?
Yes, Yes we can. (Except that i'm not aware of the usage of function such as those :))
Like this:
get_permalink($wp_query->get_queried_object_id());
same goes for pagename, and presumable others