Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#41814 closed defect (bug) (duplicate)

Custom taxonomy count shows wrong value

Reported by: subrataemfluence's profile subrataemfluence Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords:
Focuses: administration Cc:

Description

This ticket is not an exact duplicate of #20708.

I created a custom taxonomy called media-content-category and added three terms to it. Each term has at least one image attached. But wp-admin/edit-tags.php?taxonomy=media_content_category is showing wrong counts.

However, /wp-admin/upload.php?media_content_category=post-header-image&post_type=attachment shows correct number of attachment(s) for each taxonomy term.

This is how I created my custom taxonomy:

<?php
function emfl_media_content_taxonomy() {
    $labels = array (
        'name' => _x('Media Content Categories', 'Media Content Categories'),
        'singular_name' => _x('Media Content Category', 'Media Content Category'),
        'search_items' => __('Search Media Content Categories'),
        'all_items' => __('All Media Content Categories'),
        'parent_item' => __('Parent Media Content Category'),
        'parent_item_colon' => __('Parent Media Content Category:'),
        'edit_item' => __('Edit Media Content Category'),
        'update_item' => __('Update Media Content Category'),
        'add_new_item' => __('Add New Media Content Category'),
        'new_item_name' => __('New Media Content Category Name'),
        'menu_name' => __('Content Category')
    );

    register_taxonomy('media_content_category', array('attachment'), array (
        'hierarchical' => true,
        'labels' => $labels,
        'show_ui' => true,
        'show_admin_column' => true,
        'query_var' => true,
        'rewrite' => array('slug', 'content_category')
    ));
}

add_action('init', 'emfl_media_content_taxonomy', 0);

Please see screenshots.

NB: No plugin is activated.

Attachments (4)

wrong-counts.png (222.4 KB) - added by subrataemfluence 7 years ago.
Showing wrong counts
correct-number-of-items-1.png (205.4 KB) - added by subrataemfluence 7 years ago.
Correct number of items listed for inline-image taxonomy term
correct-number-of-items-2.png (184.7 KB) - added by subrataemfluence 7 years ago.
Correct number of items listed for product-photo taxonomy term
correct-number-of-items-3.png (212.9 KB) - added by subrataemfluence 7 years ago.
Correct number of items listed for product-photo taxonomy term

Download all attachments as: .zip

Change History (5)

@subrataemfluence
7 years ago

Showing wrong counts

@subrataemfluence
7 years ago

Correct number of items listed for inline-image taxonomy term

@subrataemfluence
7 years ago

Correct number of items listed for product-photo taxonomy term

@subrataemfluence
7 years ago

Correct number of items listed for product-photo taxonomy term

#1 @ocean90
7 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed
  • Version 4.8.1 deleted

Duplicate of #22558.

Note: See TracTickets for help on using tickets.