Opened 22 months ago
Last modified 16 months ago
#18594 new defect (bug)
Permalinks should be saved twice on post_type slug change
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Permalinks | Version: | 3.2.1 |
| Severity: | normal | Keywords: | close |
| Cc: | pavelevap@…, marko@… |
Description
Hello,
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 (4)
comment:1
Gecka
— 22 months 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
comment:3
markoheijnen
— 19 months ago
- Cc marko@… added
comment:4
duck_
— 16 months 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 flush_rewrite_rules();
I think there must be another ticket somewhere about this on Trac, but I couldn't find it just now.
Related #18040 ?