WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 2 years ago

#14076 closed defect (bug) (duplicate)

Misleading post count on taxonomy screen

Reported by: bunnykins Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords:
Focuses: Cc:

Description (last modified by scribu)

Register a post type that supports categories.

Wether you go to:

wp-admin/edit-tags.php?taxonomy=category

or to:

wp-admin/edit-tags.php?taxonomy=category&post_type=example

the Posts column displays the same counts.

This leaves users the false impression that category archives should display posts with any post type.

Change History (36)

#1 @bunnykins
9 years ago

I discovered a work around by mistake. The work around is to make the entry as both a normal post type and then the newly created post type and boom it fixes it. Well sort of. Creating an entry twice to get categories and tags to work for post types seems silly.

#2 @scribu
9 years ago

  • Description modified (diff)

The problem is that the counts you see on the categories page is

#3 @scribu
9 years ago

  • Description modified (diff)
  • Milestone changed from Unassigned to 3.1
  • Severity changed from critical to major
  • Summary changed from custom post types and catagories and tags to Misleading post count on taxonomy screen

The problem is that the post count is global accross all post types. It should be restricted to the current post type.

#4 @scribu
9 years ago

Related: #14073

#5 @scribu
9 years ago

Related: #14084

#6 @bunnykins
9 years ago

I might be reading your replies wrong but the replies do not seem address the problem I am having and that is using the categories and tags with the post types and then being able to click on those categories and seeing those entries. The count that is shows is a minor issues compared to the true issue I am talking about.

#7 @nacin
9 years ago

bunnykins: Are you referring to #14061?

#8 @bunnykins
9 years ago

I am not sure as I am having a bit of an issue reading what is being said there.

In looking at my issue the count is actually correct just when you click on the category it does not display the entries that are in that category for that post type.

#9 @nacin
9 years ago

Where is this inaccurate count? Back end? On your theme?

Sorry, but your steps to reproduce are a bit confusing.

#10 follow-up: @scribu
9 years ago

The issue I was refering to is this:

Register a post type that supports categories.

Wether you go to:

wp-admin/edit-tags.php?taxonomy=category

or to:

wp-admin/edit-tags.php?taxonomy=category&post_type=example

the Posts column displays the same counts.

#11 @bunnykins
9 years ago

Ok create a custom post type that uses the built in categories and tags.
Then create entries in the custom post type, set them to use one of the categories you already have created.
Say you have 3 entries created in that post type and in the same category. So you now have 3 entries in that category as well as 3 entries in the new post type.

Now go to your main page and if you have the category's widget set up it should show that category with 3 entries.

Now here is where the issue is. When you click on that category it shows no entries as if you never created any entries for that category or searched for some thing that does not exist on the site.

#12 in reply to: ↑ 10 @bunnykins
9 years ago

Replying to scribu:
> The issue I was refering to is this:

Register a post type that supports categories.

Wether you go to:

wp-admin/edit-tags.php?taxonomy=category

or to:

wp-admin/edit-tags.php?taxonomy=category&post_type=example

the Posts column displays the same counts.

Oh I was not aware that was a bug, it seemed normal to me for it to act that way, infact I would prefer it to work that way as it is showing the correct info regardless of which category's screen you are at.

My issue is related to the none admin side of things as mentioned above and I am using the new skin.

#13 @scribu
9 years ago

  • Milestone 3.1 deleted
  • Resolution set to wontfix
  • Status changed from new to closed
  • Summary changed from Misleading post count on taxonomy screen to Categories not aware of custom post types

Ok, now I finally got what you're saying.

That is the expected behaviour: category archives only display regular posts.

I'm going to close this ticket and post a solution in the original support topic.

#14 @scribu
9 years ago

  • Description modified (diff)
  • Milestone set to 3.1
  • Summary changed from Categories not aware of custom post types to Misleading post count on taxonomy screen

Actually, the reason you expected it to show all posts is precisely because of those post counts.

So, it's still an issue, except it should be fixed in a different way.

#15 @scribu
9 years ago

  • Resolution wontfix deleted
  • Status changed from closed to reopened

#17 follow-up: @bunnykins
9 years ago

So is this code going to be in a future release?

#18 @bunnykins
9 years ago

I found an issue with that fix. It breaks the azindex plug in.

#19 in reply to: ↑ 17 ; follow-up: @scribu
9 years ago

  • Keywords post type removed

Replying to bunnykins:

So is this code going to be in a future release?

Not likely.

I found an issue with that fix. It breaks the azindex plug in.

Let's keep that discussion in the support topic.

#20 @bunnykins
9 years ago

Ok why is it not likely to get fixed?
Maybe another way of fixing it is to have post types use their own categories and tags. That might fix this bug.

#21 @scribu
9 years ago

Well yes, using your own taxonomy is the way to go. I thought you had a special requirement to use categories.

#22 @scribu
9 years ago

  • Severity changed from major to normal

See

#23 in reply to: ↑ 19 @michaelh
9 years ago

Replying to scribu:

Replying to bunnykins:

So is this code going to be in a future release?

Not likely.

A possible fix could be to only include post_type=post in the counts, or if more than one post_type is include in the count don't make the count a link.

#24 @scribu
9 years ago

Yes, I was refering to the reporter's problem.

#25 @kevinB
9 years ago

  • Cc kevinB added

#26 @scribu
9 years ago

Related: #14344

It seems the cached post count column is becoming less and less useful.

#27 @nacin
9 years ago

  • Milestone changed from Awaiting Triage to Awaiting Review

#28 @dd32
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from reopened to closed
  • Version 3.0 deleted

I'm closing this as a duplicate of #14084

My reasoning: The count is global, across all post types and all post status's, It is not specific to what is visible on the front end.

As mentioned above, see this post for how to make custom post types appear in archive views, there is code elsewhere (google it..) which shows how to specifically add a post type to a archive rather than including all taxonomies.

#29 @SergeyBiryukov
6 years ago

#24376 was marked as a duplicate.

#30 @ericmann
6 years ago

#16797 was marked as a duplicate.

#31 @SergeyBiryukov
6 years ago

#25188 was marked as a duplicate.

#32 @SergeyBiryukov
5 years ago

#28629 was marked as a duplicate.

#33 @SergeyBiryukov
5 years ago

#29016 was marked as a duplicate.

#34 @SergeyBiryukov
5 years ago

#29745 was marked as a duplicate.

#35 @SergeyBiryukov
3 years ago

#37120 was marked as a duplicate.

This ticket was mentioned in Slack in #core by thomas.mery. View the logs.


2 years ago

Note: See TracTickets for help on using tickets.