WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#11907 closed defect (bug) (fixed)

invalid permalink structure when %category% is in it

Reported by: universalone Owned by: markjaquith
Milestone: 3.0 Priority: normal
Severity: normal Version: 2.9.1
Component: Canonical Keywords: permalink category
Focuses: Cc:

Description

/%category%/%postname%/ as the permalink structure works and correctly outputs the URL, for example blogurl/category1/postx

BUT if one was to input blogurl/category999/postx into the addressbar, the same postx would show up even if it was NOT in category999, just in category1.

Change History (12)

comment:1 scribu4 years ago

  • Component changed from Permalinks to Canonical
  • Milestone changed from Unassigned to 3.0
  • Owner changed from ryan to markjaquith

Confirmed in WP 3.0-alpha.

I thought this had been fixed in older versions.

comment:2 follow-up: dd324 years ago

What should be the functionality here, Canonical redirect, or a 404?

I'd be suggesting a redirect myself, as it matches the permalink structure, just wrong item within.

comment:3 scribu4 years ago

+1 on canonical redirect.

comment:4 universalone4 years ago

I agree with a canonical redirect with 301 moved permanently HTTP response.
But why did you assign it to 3.0? Can't it make it into a minor release?

comment:5 dd324 years ago

But why did you assign it to 3.0? Can't it make it into a minor release?

IMO its not serious enough to go into a 2.9.x maintainence release. Its not stoping any functionality from working, and the link should never be generated by WordPress to start with. So i'd agree with the 3.0 milestone as long as someone patches it :)

comment:6 in reply to: ↑ 2 rfair4044 years ago

Replying to dd32:

What should be the functionality here, Canonical redirect, or a 404?

I'd be suggesting a redirect myself, as it matches the permalink structure, just wrong item within.

I have trunk 12794 running at http://rfair.homelinux.com and I too am seeing this issue - see
http://rfair.homelinux.com/blog/core-development-and-testing/hello-world/

+1 more for canonical

comment:7 dd324 years ago

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

(In [13781]) Only allow %category% to be a valid category attached to the current post when using %category% in a permalink structure. Fixes #11807

(Sent it to the wrong ticket..)

comment:8 jfarthing844 years ago

  • Cc jeff@… added
  • Resolution fixed deleted
  • Status changed from closed to reopened

13781 produces a warning when visiting a post within the "Uncategorized" category (possily others, haven't tested).

Specifically:

Warning: in_array() [function.in-array]: Wrong datatype for first argument in E:\wordpress-trunk\wp-includes\canonical.php on line 170

comment:9 dd324 years ago

13781 produces a warning when visiting a post within the "Uncategorized" category (possily others, haven't tested).

I cant reproduce that myself, However, I'll add some defensive checks to the code just in case.

comment:10 dd324 years ago

(In [13798]) Add some defensive checks to Canonical redirection of %category% to ensure notices are not thrown. Props jfarthing84 for pointing out possibility. See #11907

Seems that commit notice skiped the ticket.

Can you just check to see if the warnings are still present?

comment:11 jfarthing844 years ago

I'm not seeing it anymore.

comment:12 dd324 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.