You could do this by creating a custom WP_Query
and then counting it.
$args = array(
'author' => 1,
'cat' => 5,
);
$my_query = new WP_Query( $args );
$my_count = $my_query->post_count;
Just change 1
and 5
to the Author ID and Category ID respectively.
Alternatively you can use the category slug or author’s nice name (NOT name!) as well:
$args = array(
'author_name' => 'bob',
'category_name' => 'editorial',
};
Related Posts:
- C++ – how to find the length of an integer
- How can I make a PHP counter?
- Counting the posts of a loop (WP_Query)?
- Category and children post count
- Hide the post count behind Post Views (Remove All, Published and Trashed) in Custom Post Type
- How to display 2 equal columns of li based on the count of items in wp_nav_menu divided by 2?
- Show weekly posts statistic in WordPress
- Increasing post view count automatically [duplicate]
- How we count the user draft posts
- What is the best way to count and display the number of posts?
- Get count of terms with a post and another taxonomy term?
- Get Gravity Forms field values and count how many? [closed]
- Counting posts in custom post type by author
- Show ellipsis (…) only if the number of characters exceeds limit defined in substr
- Get total views of all posts by author
- Count post + add number =
- How to do simple addition to increase favorites count of my wordpress posts
- Count posts published in one particular day: the lighter way
- What is the best way to do this? [closed]
- Search Count WordPress Theme
- How to read out the excerpt length (for if-condition)
- $count_posts->draft & published
- CountPost WordPress Custom Taxonomy
- get the count of table rows
- How to calculate posts number? [closed]
- How make animation increase of number
- Having problems getting the number of plays in a WordPress Playlist from an audio file
- How to show the amount of post that have on the site?
- Pandas ‘count(distinct)’ equivalent
- How to sort a list of objects based on an attribute of the objects?
- Count the number of occurrences of a character in a string
- How to get the count of each distinct value in a column?
- How to Display Network Post Count?
- Audio or playlist shortcode condition according to the amount of files on attachment page
- How to update incorrect post count in taxonomy?
- Problem with get_posts, tax_query and counting the number of posts
- Insert html after certain amount of posts?
- Specific Loop For 2 Within Each
- Get count of custom post type created by current user
- Number of items in a menu
- How to count get_users query?
- Post count per (day/month/year) since blog began
- Count number of published posts by type
- Total Word Count For Posts And Comments By One Author
- Double count view in archive.php
- count_many_users_posts except current logged in user?
- Count total number across post types
- Woocoomerce product category count including subcategories
- How to hide first gallery for every post?
- Counter of posts ever posted – even deleted ones
- Modify text after post count
- Pagination is not working properly in Product Category/Tag pages
- Apply an Incremental Counter in an Array Function
- Remove ID page from wp_count
- How can I get global $post to work for CPT and update user?
- Count comment threads, not total comments in a post
- Count posts by type including drafts and pending posts
- How to display users with posts published between two dates (Sorted by Post-Count) [Multisite]
- Display Notification Bar on Header on Certain Post Count
- Multisite – maximum number of users with specific role
- Add “showing posts x to x of y” in custom post type paginated loop
- How do I count columns on a custom WPDB query?
- Count post views in loop
- If x comments in a post move post to category y
- Count tags for a specific category
- line order number start numbering from second line (SOLVED)
- how to count the current posts terms
- Count the number of a post types associated with another post type
- 2 queries with counters
- How to exclude posts from category posts count
- Breaking Bootstrap Grid at Post Count with Tax Terms
- How to stop the deduction in “wp_term_taxonomy” count, when the post is deleted?
- Taxonomy term count
- Display amount of pending posts in back/front end
- Displaying number of drafts in Posts section of admin sidebar [closed]
- wpdb->get_var – count author posts, meta value
- Counting number of posts in multiple (sub)categories using shortcode
- Counting a WP_Post Object value in an arary, using a filter?
- Set post title font size automatically according to number of words in post title
- List all categories and count number of posts within based on custom date
- Like and Dislike Buttons on Post with Counter – Only allow one click per post per user session
- How do I find the count of the current post?
- order posts by a secondary query that counts items
- Get user count based on multiple meta key values?
- How to show custom post count in archive page
- Warning: count(): syntax problem of the count () function
- How to get the total count of Favorite/Favorited authors
- Display Custom Post Category Count & WordPress Category Count Using Shortcode
- number of posts with “Load More”
- I have a problem with displaying children pages of custom post type
- Get the total Author Favorited posts
- Alternative content between posts no repetition
- How to prevent authors from editing their post count?
- How to control Post view count incresing in sidebar widget posts too?
- conditional based upon the count of current user’s published custom posts
- Display Count of posts
- Taxonomy count per Post type
- Issues with the excerpt (wordcount/HTML/images)
- how to show Author post type count
- Count the number of matching post names in foreach loop