Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#16644 closed defect (bug) (fixed)

[15825] Changed the format of our category links from ?cat=123 to ?category_name=slug

Reported by: markjaquith Owned by:
Priority: high Milestone: 3.1.1
Component: Permalinks Version: 3.1
Severity: normal Keywords: has-patch
Cc: bigonroad

Description

Before [15825], default category links used the ID (?cat=123). After [15825], they started using ?category_name=slug. There are no canonical redirects.

Attachments (3)

16644.diff (1.3 KB) - added by greuben 2 years ago.
16644.2.diff (505 bytes) - added by dd32 2 years ago.
get_term_link modification for ?cat=
16644.3.diff (1.6 KB) - added by greuben 2 years ago.

Download all attachments as: .zip

Change History (22)

comment:1 follow-up: ↓ 3   bigonroad2 years ago

When you say "no canonical redirects", do you mean one of the links doesn't work at all, or just that neither link is 301-ing to the other?

  • Cc bigonroad added

comment:3 in reply to: ↑ 1   kawauso2 years ago

Replying to bigonroad:

When you say "no canonical redirects", do you mean one of the links doesn't work at all, or just that neither link is 301-ing to the other?

Both links work, no 301-ing takes place.

comment:4   dd322 years ago

This comes back to the query_Var being set to category_name rather than 'cat' as you'd expect in this case.

The solution would be to change that var, however, I'm pretty sure we'll then also run into the fact that the rewrite rules are also based on that query variable.

dd32 — what do rewrite rules matter? This is for default permalinks — no rewrite rules are in play.

greuben2 years ago

  • Keywords has-patch needs-testing added; needs-patch removed

comment:7 follow-up: ↓ 8   nacin2 years ago

We need to move back to cat=. category_name= should still work and should probably canonically redirect.

comment:8 in reply to: ↑ 7   greuben2 years ago

  • Keywords needs-patch added; has-patch needs-testing removed

Replying to nacin:

We need to move back to cat=. category_name= should still work and should probably canonically redirect.

Oops I thought ?cat= should redirect to ?category_name=

comment:9   dd322 years ago

Replying to markjaquith:

dd32 — what do rewrite rules matter? This is for default permalinks — no rewrite rules are in play.

I was attempting to make the point of why the change has happened, That it's using the query_var specified in the register_taxonomy call, of whcih, is also utilised by the rewrite rule generation code, when you also look at the get_term_link code, it either uses the permastruct in use, or the query_var, Ie. The generated rewrite rules, as well as the non-rewrite rules rely on the same query var param

get_term_link either needs a specific branch for categories in the non-rewrite context to use cat + id rather than category_name + slug (as all other taxonomy non-rewrite rules are)

dd322 years ago

get_term_link modification for ?cat=

  • Keywords has-patch added; needs-patch removed

attachment 16644.2.diff added

  • modifies get_term_link to return ?cat= links.

greuben2 years ago

attachment 16644.3.diff added

extended dd32's patch for canonical redirects

Per bug scrub, 16644.2.diff is the direction we want to go. We don't want to change canonical in a dot release. Let's test .2 and get it in.

I tested 16644.2.diff on a couple trunk installs and it works for me

comment:15 follow-up: ↓ 18   markjaquith2 years ago

greuben — can you open a ticket with category_name canonical redirect against future release? Just don't want that in 3.1.1

16644.2.diff is good. Going in.

  • Resolution set to fixed
  • Status changed from new to closed

(In [17494]) Revert to the cat=X permalinks from 3.0 and earlier. props dd32. fixes #16644 for trunk

(In [17495]) Revert to the cat=X permalinks from 3.0 and earlier. props dd32. fixes #16644 for 3.1

comment:18 in reply to: ↑ 15   greuben2 years ago

Replying to markjaquith:

greuben — can you open a ticket with category_name canonical redirect against future release? Just don't want that in 3.1.1

#16728

?cat= doesn't include children after all, so get_term_link() will return URLs with different results, based on wether permalinks are turned on or not.

However:

(12:34:42 AM) rboren: That should return it whatever 3.0 did, yes? I don't care what it does as long it is what 3.0 does. :-)
(12:35:16 AM) rboren: I need a drink to talk about taxonomy.

Alas, I don't have enough whiskey to make that change. :)

Note: See TracTickets for help on using tickets.