Opened 9 years ago
Last modified 5 years ago
#36305 new defect (bug)
Permalink can't decide the parent category
Reported by: | gr8shivam | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Permalinks | Keywords: | |
Focuses: | Cc: |
Description
The bug:-
There is a bug in the permalink generation that it can't decide the parent category. This means that even though we choose the child & parent both as a post's category, it creates the permalink as /parent/child/ in certain situations.
Please note that the Permalink Structure is set to:-
/%category%/%postname%/
What should happen:-
If we choose a parent category as well as the child category as post's categories, the permalink should be:
/parent/
And if we choose only the child as post category, the permalink should be:
/parent/child/
Demonstration:-
I created a parent-child category set as "Parent 1 (parent) & Child 1 (child)" & another set as "Parent 2 (parent) & Child 2 (child)". The difference between the two sets is that 'Child 1' was created before 'Parent 1' & then edited to have 'Parent 1' as it's parent, while the 'Child 2' was created after 'Parent 2'.
Now, if I choose 'Parent 1' & 'Child 1' as a post's category, it creates the permalink as:
/parent-1/child-1/hello-world/
And if I choose 'Parent 2' & 'Child 2' as a post's category, it creates the permalink as:
/parent-2/hello-world/
How to reproduce the bug:-
- Create a category 'child 1'.
- Create another category 'parent 1'.
- Now edit the 'child 1' category and set 'parent 1' as it's parent.
- Now the permalink can't judge that 'parent 1' is the parent of 'child 1' & creates a wrong permalink as if only 'child 1' was selected.
Possible Reason:-
A possible reason for this bug maybe due to the category id. Here, the 'Child 1' has lesser category id than 'Parent 1'. And the permalink algorithm checks for the least selected category id.
The Permalink generated on choosing Parent 1 & Child 1 as categories of a post.