Taxonomy bug
-
I’m not sure if this is a bug in core or if I’m doing something wrong.
I have some code which generates a post-type called “Books” and I’m adding support for the post_tag taxonomy via register_taxonomy_for_object_type().
<?php function test() { $args = array( 'public' => true, 'label' => 'Books', ); register_post_type( 'book', $args ); register_taxonomy_for_object_type( 'post_tag', 'book' ); } add_action( 'init', 'test' );
There are three posts in the book post-type:
https://uploads.ryanhellyer.net/random/2014/10/books-tags.pngViewing the tags in the book post-type shows up all of the tags, including those from the posts post-type (note that the “Asten” tag indicates it has one post):
https://uploads.ryanhellyer.net/random/2014/10/books-tag.pngIf I click on the Asten post tag, it displays no posts at all.
https://uploads.ryanhellyer.net/random/2014/10/books-tag-good.pngIf I go to the posts post-type, the Asten post tag does show a post as expected:
https://uploads.ryanhellyer.net/random/2014/10/posts-tag.pngQuestion: Why does the “Asten” post tag display “1” when I’m on the book post-type? There is no post for the book post-type with a tag of “Asten” and so this should surely say “0” right? Clicking something which indicates there is one post, but it displaying zero does not make sense to me.
- The topic ‘Taxonomy bug’ is closed to new replies.