[wp-trac] [WordPress Trac] #16397: Selecting Sub-Category should select parent category.

WordPress Trac wp-trac at lists.automattic.com
Tue Feb 1 17:02:15 UTC 2011


#16397: Selecting Sub-Category should select parent category.
-----------------------------+----------------------
 Reporter:  sterlo           |       Owner:
     Type:  feature request  |      Status:  closed
 Priority:  normal           |   Milestone:
Component:  General          |     Version:  3.1
 Severity:  normal           |  Resolution:  wontfix
 Keywords:                   |
-----------------------------+----------------------

Comment (by sterlo):

 I submit this UseCase without any plugins installed:

 Created a parent category and a child category:
 {{{
 mysql> select * from wp_terms; select * from wp_term_taxonomy;
 }}}
 Results (terms):
 ||term_id||name||slug||term_group||
 ||22||omgwtfbbq||omgwtfbbq||0||
 ||23||lulz||lulz||0||

 Results (taxonomy):
 ||term_taxonomy_id||term_id||taxonomy||description||parent||count||
 ||22||22||category||This is a parent category.||0||0||
 ||23||23||category||This is a child of omgwtfbbq.||22||0||

 I then created a post! Actually...I created three.

 One that belongs to the parent category.[[BR]]
 One that belongs to the child category (parent no selected).[[BR]]
 One that belongs to both.

 Now...the terms show up as thus:

 {{{
 select * from wp_term_taxonomy;
 }}}
 ||term_taxonomy_id||term_id||taxonomy||description||parent||count||
 ||22|||22||category||This is a parent category.||0||2||
 ||23|||23||category||This is a child of omgwtfbbq.||22||2||

 So this reflects your expectation in the form of data.

 But if I ask WordPress if the Parent category has posts in it:
 {{{
 $test=get_posts('category_name=omgwtfbbq');
 echo count($test);
 }}}

 Result: 3

 So if we're going to treat it as though it actually has 3 posts in
 it...why not...actually have 3 posts in it?

 I understand we can right a plugin to "fix" problems. Or we could ... fix
 the problems.

 If this is not a problem, I will defer to your judgment.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16397#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list