An alternative solution using WP_Query would be:
$args = array(
'cat' => 4,
'post_type' => 'videos'
);
$the_query = new WP_Query( $args );
echo $the_query->found_posts;
Related Posts:
- How to mark every 3rd post
- How to Display a List of Users Who Have Made at Least 1 Post?
- How to Display Network Post Count?
- How to cache a shortcode functions output?
- Count posts in category including child categories
- Count singular post views automatically
- Set font size automatically according to number of words in post
- Network wide post count (WP Multisite)
- Redirect based on user post count
- Alternate custom content in the loop
- Show that current post is number X out of X
- Show the author’s count of total amount of posts assign to a custom taxonomy term
- Double count view in archive.php
- Count to how many categories a post belongs to
- Count total number across post types
- Count search results in heading
- How to hide first gallery for every post?
- Counter of posts ever posted – even deleted ones
- Display Published Posts Count for Certain Time Period
- How can I get global $post to work for CPT and update user?
- Display Notification Bar on Header on Certain Post Count
- Show posts count for Categories and Tags in wp_nav_menu
- How to add category post count in main navigation menu [closed]
- Count number of posts of current month
- Howto show comment count by post in post?
- Counter is skipping post when I still want it visible [closed]
- Count several post tags
- Get post number both in the loop and in the post
- How do I insert a after every 5 posts in a WordPress Loop that infinitely loads posts?
- Count the number of a post types associated with another post type
- Echo the number of posts being displayed
- Display amount of pending posts in back/front end
- Count user posts and store the number for later use
- why the posts queried from sql is more than those showed on the page?
- Count the total views of all user posts published
- Author post count in category
- Set post title font size automatically according to number of words in post title
- Show post count in custom taxonomy page
- Count singular post views automatically
- How to count posts in tags within time limit
- Display Custom Post Category Count & WordPress Category Count Using Shortcode
- Counting Posts by Category
- Display number of post published every day
- Retrieve posts inside foundation tabs and tab-content split by 3 per row
- Alternative content between posts no repetition
- count_posts to a standalone link
- How to control Post view count incresing in sidebar widget posts too?
- How to mark every 3rd post
- Add a minimum word count to Excerpt (and how to force Excerpt as a rule for WyPiekacz)
- How to limit the number of posts a user can publish based on user type
- ho can I get the number of the current post instead of the post id?
- post_count not working
- Adding Count Post in Page
- Count words for all posts by all authors
- Word count for all posts of all authors
- Display post count on archive page in reverse order
- Display Random Author with Details in Sidebar
- Get old values for post before saving new ones
- order posts by date like craigslist
- What to use: wp_is_post_autosave( $post_id ) or DOING_AUTOSAVE?
- Why do I need to use The Loop on pages (inside page.php etc)?
- How to get previous 10 days post from a specific date – WP Query
- Automatically added brs and paragraphs?
- Allowing a user to write a post from another website?
- prevent showing posts of an specific category in admin posts section
- New blog template to display only one category
- wp_insert_post question [closed]
- publish_post conflicts with save_post
- Contact form 7 post loop [closed]
- WordPress list posts from sub categories
- Dynamically generate child-URLs for posts or custom posts
- Format the Layout of Images In The Edit Post Textarea?
- Get Posts Under Custom Taxonomy
- wp_query random post
- How to get a post’s content? [closed]
- Every second post different class in blog view
- Is codex right on deleting post?
- WP text styles not coming through to actual post
- WordPress post page not working properly
- Changing Post Tag Color Based On Post Count
- Programatically adding custom filters to post list
- Is it possible to automatically publish a post once a woo-commerce product is published?
- Retrieve post in AJAX Callback
- Adding JS functionality to the Publish button in wp-admin/post.php
- Get postlist for each category using query_posts?
- Why does WordPress search returns same number of results for every search query?
- links to posts not working on homepage
- Posts and order
- Nest Next and Previous in a href with class that has a background image
- Override WordPress core post-template.php block template
- Pagination (on the static front page) shows always the same posts
- Loop through all posts showing duplicates
- Code works on a page but not in a widget
- Get post title by Alphabet
- Make a paginated article (for easier reading on mobile)
- WordPress post text starts newline after 93 characters
- Deleling wordpress posts permanently still have IDs
- wp trim function not working
- Custom Post-Rename Function Does Not Function in WordPress 6.x
- Import alt text in set_post_thumbnail