[wp-trac] [WordPress Trac] #36305: Permalink can't decide the parent category

WordPress Trac noreply at wordpress.org
Wed Mar 23 10:46:13 UTC 2016


#36305: Permalink can't decide the parent category
--------------------------+-----------------------------
 Reporter:  gr8shivam     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Permalinks    |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 '''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:-'''
 1. Create a category 'child 1'.
 2. Create another category 'parent 1'.
 3. Now edit the 'child 1' category and set 'parent 1' as it's parent.
 4. 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.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36305>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list