Make WordPress Core

Opened 15 years ago

Closed 12 years ago

#14345 closed defect (bug) (fixed)

BUG: Changing permalinks to a custom structure returns 404 on custom post types

Reported by: der's profile der Owned by:
Milestone: 3.6 Priority: normal
Severity: normal Version: 3.0
Component: Permalinks Keywords: has-patch commit 3.6-early
Focuses: Cc:

Description

To replicate the bug, do this:

  • Create a custom post type
  • Enable permalinks with the following custom structure: /%category%/%postname%
  • Save the settings
  • Access your post's permalink: It will return a 404 page
  • Go to permalink settings again (don't change anything) and Save the settings again.
  • Access your post's permalink: It will go to the post.

If you save the first time, it's not registering the changes, unless you save the settings for the second time without making any changes.

Change History (15)

#1 @nacin
14 years ago

  • Keywords reporter-feedback added; permalinks 404 removed

How is the post type registering and flushing rules? This doesn't seem right. Rules get flushed on every request for options-permalink.php.

#2 @dd32
14 years ago

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

Closing as workdforme, In the event that this is still a problem, please re-open it with more details on the registration.

#3 @nofearinc
13 years ago

  • Resolution worksforme deleted
  • Status changed from closed to reopened

I want to report the same issue.

I have a custom post type book which is working as supposed to with the standard permalink structure '?book=aus-tranen-werden-kristalle'. Setting a permalink structure as /%postname%/ rewrites the URLs in the following manner: '/book/aus-tranen-werden-kristalle'. This URL is no more accessible and marked as 404.

Also, when featured image is introduced for that post type, it is displayed but with the incorrect template. I use different templates for custom post types and the book template is not applied here.

Calling the get_post_type() returns NULL or 'attachment'.

#4 @dd32
13 years ago

Can you please post a minimal code sample which can be used to reproduce the problem? Specifically any code used for registering the post type, as well as flushing the rules.

While You're at it, check to see if it happens with no other plugins loaded.

#5 @pavelevap
13 years ago

  • Cc pavelevap@… added

Related #18040 ?

#6 @dd32
13 years ago

Related #18040 ?

That's what I was thinking of actually.

nofearinc: does it work as expected if you Hit Save on the permalinks options page again? - If so, this can be closed as a duplicate of the above.

#7 @SergeyBiryukov
13 years ago

  • Milestone set to Awaiting Review

#8 @wonderboymusic
12 years ago

#21824 was marked as a duplicate.

#9 @wonderboymusic
12 years ago

  • Keywords needs-patch added; reporter-feedback removed
  • Milestone changed from Awaiting Review to 3.5

#10 @wonderboymusic
12 years ago

Related / possible fix = #9296

#12 @nacin
12 years ago

  • Keywords has-patch commit 3.6-early added; needs-patch removed
  • Milestone changed from 3.5 to Future Release

#13 @helen
12 years ago

  • Milestone changed from Future Release to 3.6

#14 @nacin
12 years ago

In 24060:

Redirect after save on options-permalink.php to ensure permalinks are fully flushed. fixes #9296. see #14345 for more.

#15 @nacin
12 years ago

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

I switched the two ticket references in [24060] — fixes #14345, see #9296 for more.

Note: See TracTickets for help on using tickets.