Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics

Specify Count per different post types?

ACP supports the post Count column.

I have a taxonomy, “Events”, which is attached to custom post types “Article”, “Viewpoint” and others.

Whether I view edit-tags.php?taxonomy=event&post_type=viewpoint or edit-tags.php?taxonomy=event&post_type=article

… the Count value is the same number. I’m not sure whether this is a combined value for both post types.

Does ACP allow me to set a Count column for individual post types?

1 year, 9 months ago

Hi Robert,

You’re lucky, that specific column is created for the upcoming release and is called ‘Count per Post type’.
So have a look at this new column in the new version of Admin Columns. This new column has an option where you can set which post type it should count.

1 year, 9 months ago

Beautiful, Stefan. Thanks! I thought I saw a commit in GitHub for this.

A couple of things…

– A future refinement may be to support sorting on the chosen post Count.

– For hierarchical taxonomies, This seems to work a different way from the native Count column…

In this image, notice how, for the “Companies” parent term, WordPress is showing a “0”, which is correct since there are 0 posts of any type tagged with “Companies”.

But, for “Articles” and “Viewpoints” which are set by your “Count per Post type”, they are calculating the count of the children terms and putting it at the parent level.

I’m not really sure which should be considered *correct* behaviour (and perhaps even WordPress has a setting to stop tallying child term counts at the parent level) – but right now (unless I have added some code somewhere to suppress child counts and forgotten about it) there may be two different behaviours going on.

1 year, 9 months ago

You must be logged in to reply to this topic.