[wp-trac] [WordPress Trac] #43995: wp_dropdown_categories(array( 'pad_counts' => true ) ) doesn't correctly pad counts on post_types with custom stati

WordPress Trac noreply at wordpress.org
Mon May 7 17:53:33 UTC 2018


#43995: wp_dropdown_categories(array( 'pad_counts' => true ) ) doesn't correctly
pad counts on post_types with custom stati
--------------------------+-----------------------------
 Reporter:  pbiron        |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Taxonomy      |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Suppose I have the following situation:

 * a custom post type (e.g., `member`)
 * post type `member` has custom post stati (e.g., `subscribed` and
 `unsubscribed`)
 * **ALL** posts of post type `member` have one of these custom stati
 (i.e., **NONE** have post_status `publish`).
 * a hierarchical taxonomy (e.g., `membership-status`) is registered on
 post type `member`
 * taxonomy `membership-status` looks like the following:
    * Membership
       * Current
       * Expired

 and that the term `Current` has been assigned to 10 posts, `Expired` has
 been assigned to 5 posts and that `Membership` has been assigned to **0**
 posts.

 If I then call
 {{{
 #!php
 $args = array(
     'taxonomy' => 'membership-status',
     'show_counts' => true,
     'pad_counts' => true,
     ...
 );
 wp_dropdown_categories( $args );
 }}}

 I expect to get a dropdown that looks like:

 * Membership (15)
   * Current (10)
   * Expired (5)

 Instead, I get the following:

 * Membership (0)
   * Current (10)
   * Expired (5)

 which is, obviously, not correctly padding the count for `Membership`.

 Related: #11847, #13176

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


More information about the wp-trac mailing list