Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#24376 closed defect (bug) (duplicate)

Sharing Custom Taxonomies with built-in Post Types

Reported by: ZaneMatthew Owned by:
Priority: normal Milestone:
Component: Taxonomy Version: 3.5.1
Severity: normal Keywords:
Cc: Focuses:

Description

If you register a custom taxonomy for built-in post types the admin pages containing the table and count for the custom taxonomy have the wrong count for each term.

Use case, I've register a custom taxonomy and assigned to the Post and Page post types like the following:

register_taxonomy(
    'cat',
    array('post','page'),
    array(
        'labels' => array(
            'name'                => _x( 'Cat', 'taxonomy general name' ),
            'singular_name'       => _x( 'Cat', 'taxonomy singular name' ),
            'search_items'        => __( 'Search Cats', 'some_plugin' ),
            'all_items'           => __( 'All Cats', 'some_plugin' ),
            'parent_item'         => __( 'Parent Cat', 'some_plugin' ),
            'parent_item_colon'   => __( 'Parent Cat:', 'some_plugin' ),
            'edit_item'           => __( 'Edit Cat', 'some_plugin' ),
            'update_item'         => __( 'Update Cat', 'some_plugin' ),
            'add_new_item'        => __( 'Add New Cat', 'some_plugin' ),
            'new_item_name'       => __( 'New Cat Name', 'some_plugin' ),
            'menu_name'           => __( 'Cat', 'some_plugin' )
        ),
        'hierarchical' => true,
        'show_admin_column' => true,
        'show_ui' => true  
    )
);

If you add a post and create different cats, you'll see the same count shows in both admin taxonomy UIs

/wp-admin/edit-tags.php?taxonomy=cat
/wp-admin/edit-tags.php?taxonomy=cat&post_type=page

Change History (2)

#1 @ZaneMatthew
13 years ago

  • Component General → Taxonomy

#2 @SergeyBiryukov
13 years ago

  • Milestone Awaiting Review
  • Resolution → duplicate
  • Status new → closed

Duplicate of #14076 and #20708.

Note: See TracTickets for help on using tickets.