WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Tag counts incorrect in wp_term_taxonomy table

[Resolved] Tag counts incorrect in wp_term_taxonomy table

  • I created a custom post type and added post_tag and category as taxonomies for this custom post type. Now I created a few posts for this post_type, and added tags to it. When i go to the “edit_tags” page, the post count for the tag is zero. So I checked the database, and this is what I found.

    wp_term_relationships shows that the tag is associated with four posts, all posts of the same custom post type.

    Screenshot: http://www.humbug.in/wp-content/uploads/pics/tag-error-ss1.jpg

    However wp_term_taxonomy table shows 0 posts for the tag

    Screenshot: http://www.humbug.in/wp-content/uploads/pics/tag-error-ss2.jpg

    Code used to add the post type.

    $p2_custom_post_type = 'aside';
    $p2_custom_post_type_name = 'Asides';
    $p2_custom_post_type_singular_name = 'Aside';
    
    register_post_type( "$p2_custom_post_type",
            array(
                'labels' => array(
                'name' => __( "$p2_custom_post_type_name" ),
                'singular_name' => __( "$p2_custom_post_type_singular_name" )
                ),
                'public' => true,
                'supports' => array( 'title', 'editor', 'thumbnail', 'trackbacks', 'comments', 'custom-fields' ),
                'capability_type' => 'post',
            )
        );

    Added the taxonomy using the following code.

    register_taxonomy_for_object_type('category', $p2_custom_post_type);
    register_taxonomy_for_object_type('post_tag', $p2_custom_post_type);

    What am I doing wrong?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Tag counts incorrect in wp_term_taxonomy table’ is closed to new replies.
Skip to toolbar