Make WordPress Core

Opened 12 years ago

Closed 10 years ago

Last modified 8 years ago

#18594 closed defect (bug) (invalid)

Permalinks should be saved twice on post_type slug change

Reported by: gecka's profile Gecka Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.2.1
Component: Permalinks Keywords: close
Focuses: Cc:



In a plugin I allow my users to set the slug of a custom post type from a sttings page. I flush the rules on every load of that settings page (only that page)

When they change the slug, they have to save and then reload the settings page for the permlink to be correctly chnaged.... A single flush_rules call shouldn't be enought?

Change History (6)

#1 @Gecka
12 years ago

  • Summary changed from Përmalinks should be saved twice on post_type slug change to Permalinks should be saved twice on post_type slug change

#2 @pavelevap
12 years ago

  • Cc pavelevap@… added

Related #18040 ?

#3 @markoheijnen
11 years ago

  • Cc marko@… added

#4 @duck_
11 years ago

  • Keywords close added
  • Severity changed from critical to normal

It sounds like the problem is that you're flushing the rewrite rules but with the old custom post type information still registered. The fix would be to re-register your post type after updating the option, e.g.

update_option( 'my_post_type_slug', $slug );
my_post_registration(); // calls register_post_type(), usually hooked into init

I think there must be another ticket somewhere about this on Trac, but I couldn't find it just now.

#5 @duck_
10 years ago

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

No news in over a year. This is likely due to doing it wrong.

The situation can be improved. This is being handled in #18450. Also see #20171.

#6 @selnomeria
8 years ago

have found something similar issue! - #32023

Last edited 8 years ago by SergeyBiryukov (previous) (diff)
Note: See TracTickets for help on using tickets.