#19794 closed defect (bug) (fixed)
Rewrite rules for custom taxonomies not generated as permalinks are switched on
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.4 |
| Component: | Rewrite Rules | Version: | 3.3.1 |
| Severity: | major | Keywords: | has-patch |
| Cc: | scribu |
Description
The rewrite rules are not being created for any custom taxonomies when you select the 'Postname' structure. You must first select either 'Day and name' or 'Month and name' (but not 'Numeric'), save the permalink structure, and then select 'Postname' and resave.
I think selecting 'Numeric' fails for above method because none of the taxonomy rules are altered at all when you select 'Postname', so the ones that were created by 'Numeric' still start with 'archive/'.
Attachments (1)
Change History (12)
comment:2
follow-up:
↓ 3
SergeyBiryukov
— 18 months ago
comment:3
in reply to:
↑ 2
;
follow-up:
↓ 5
duck__boy
— 17 months ago
Replying to SergeyBiryukov:
Can't reproduce on a clean install. My steps:
- Set permalinks to "Post name".
- Create a custom taxonomy and assign it to a post. I've used Genres and Writers example from Codex with a minor adjustment: for standard posts rather than a book post type.
- Flush rewrite rules by visiting Permalink Settings screen (without changing the structure).
- The taxonomy archive (e.g. /genre/science-fiction/) is properly displayed.
Have you tried setting the permalinks to 'Default', to remove all rewrite rules, and then setting them back to 'Post name'? To my understanding, when you add a taxonomy the rules are flushed, so your steps would not see an error - it is only when you change the structure after creation.
comment:4
follow-up:
↓ 6
dd32
— 17 months ago
Can you please do the following?
- Post an example piece of code to reproduce it (as simple as possible?) - A similar problem happens sometimes when the incorrect hooks are used
- Does hitting save twice on the permalinks page help?
comment:5
in reply to:
↑ 3
SergeyBiryukov
— 17 months ago
Replying to duck__boy:
Have you tried setting the permalinks to 'Default', to remove all rewrite rules, and then setting them back to 'Post name'?
Just tried that. Taxonomy archive is only displayed then after saving the changes twice, as dd32 suggested. This seems to be the case for other (non-default) structures too, not just "Post name".
comment:6
in reply to:
↑ 4
duck__boy
— 17 months ago
Replying to dd32:
Can you please do the following?
- Post an example piece of code to reproduce it (as simple as possible?) - A similar problem happens sometimes when the incorrect hooks are used
- Does hitting save twice on the permalinks page help?
I'm unable to post code, as this occurs in the admin panel under permalinks, not through code. And yes, saving it twice does seem to work.
comment:7
follow-up:
↓ 8
dd32
— 17 months ago
I'm unable to post code, as this occurs in the admin panel under permalinks, not through code. And yes, saving it twice does seem to work.
But your custom taxonomies are added via code correct? It sounds like Sergey has duplicated however.
This sounds exactly like #16736 which was supposed to be fixed in 3.3
comment:8
in reply to:
↑ 7
duck__boy
— 17 months ago
Replying to dd32:
I'm unable to post code, as this occurs in the admin panel under permalinks, not through code. And yes, saving it twice does seem to work.
But your custom taxonomies are added via code correct? It sounds like Sergey has duplicated however.
This sounds exactly like #16736 which was supposed to be fixed in 3.3
Sorry, yes taxonomies are added via code (register_taxonomy()), but that is not what this issue is about. And yes, sounds similar to the other ticket.
SergeyBiryukov
— 17 months ago
comment:9
SergeyBiryukov
— 17 months ago
- Keywords has-patch added
- Milestone changed from Awaiting Review to 3.4
Looks like #16736 wasn't really fixed. [18443] fixed #18040 for CPT, but the similar issue still exists for custom taxonomies.
19794.patch implements the same fix for register_taxonomy().
comment:10
duck_
— 16 months ago
- Owner set to duck_
- Resolution set to fixed
- Status changed from new to closed
In [19930]:
comment:11
duck_
— 16 months ago
- Summary changed from Rewrite rules for custom taxonomies not being created for 'Postname' structure to Rewrite rules for custom taxonomies not generated as permalinks are switched on
Can't reproduce on a clean install. My steps: