[wp-trac] [WordPress Trac] #18734: Subcategory archive does work with any name as parent category in URL

WordPress Trac noreply at wordpress.org
Thu Oct 8 21:04:25 UTC 2015


#18734: Subcategory archive does work with any name as parent category in URL
-------------------------------------------------+-------------------------
 Reporter:  ocean90                              |       Owner:
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Future
Component:  Canonical                            |  Release
 Severity:  normal                               |     Version:  3.0.1
 Keywords:  needs-unit-tests has-patch dev-      |  Resolution:
  feedback                                       |     Focuses:
-------------------------------------------------+-------------------------
Changes (by kasparsd):

 * keywords:  needs-unit-tests needs-patch => needs-unit-tests has-patch
     dev-feedback


Comment:

 Attached is a patch that will

 - ensure that the current category has a parent category,
 - ensure that the category permastructure actually contains the category
 slug `%category%`

 Only then it will

 - generate a list of all parent categories,
 - check if the category path matches the
 `$wp->query_vars['category_name']`
 - replace the incorrect category path `$wp->query_vars['category_name']`
 with the correct one

 Notice that this approach will respect any pagination, feeds and custom
 endpoints that might be present in the URL.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/18734#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list