(Moderator’s note: The original title was “How to know the number of custom type posts having a specific taxonomy”)
I’m stuck with the function wp_count_posts()
!
I created custom post types called 'artwork'
to display artworks in a gallery. I also created a custom taxonomy called 'artworkcat'
to sort each artwork into a specific category ('webdesign'
, 'logo'
, 'print'
).
I would like to use the wp_count_posts()
to know how many posts I have using the 'artwork'
custom post type, in a specific category.
If that’s not clear, I give you a practical example : I would like to know how many posts I have in this 'artwork'
custom post type, with the ‘artworkcat’ taxonomy called ‘webdesign’.
Does wp_count_posts()
work for this, adding some parameters ?
Thanks for the help !