Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#24376 closed defect (bug) (duplicate)

Sharing Custom Taxonomies with built-in Post Types

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

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
11 years ago

  • Component changed from General to Taxonomy

#2 @SergeyBiryukov
11 years ago

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

Duplicate of #14076 and #20708.

Note: See TracTickets for help on using tickets.