There is no default/native function in wordpress to count posts from a specific meta value. wp_count_posts
only counts the amount of posts according to post type
It might be useful here to use WP_Query
to create a custom query to get all posts with that specific meta value and then use $wp_query->found_posts
to get the post count.
This should do it
$query = new WP_Query( array( 'meta_key' => 'color', 'meta_value' => 'blue' ) );
echo $query->found_posts;
Related Posts:
- Taxonomy count per Post type
- Count posts or custom post types from last 24 hours (or from today)
- Count posts that have specific taxonomy term attached
- taxonomy list display custom post count
- Count custom post types with a specific meta value
- Custom Post Type Category List & Post Count
- Taxonomy list. Order by a specific custom post type count
- Get count of custom post type created by current user
- get_queried_object error How to show post count by month in the taxonomy page
- How to count custom post types with conditional operators
- Count posts with specific term_meta
- count_many_users_posts except current logged in user?
- Count all comments of a custom post type
- right_now_content_table_end function not working?
- WordPress count child posts of each parent custom post type and use in json array for google maps jquery plugin
- Query/list all terms and their custom post count
- How to make sure content doesn’t display if selection is empty
- Post count by month of taxonmy term
- custom post type category count shortcode
- How to display author post count for multiple custom post types?
- Post loop count is not in order
- I am trying to get cutom post cout by month of current taxonmy term
- how to count the current posts terms
- Trying to add a class to post links
- How to count other posts not having specific taxonomy terms?
- WordPress Count posts within a custom post type
- Display custom post counts for author , not default posts
- display post count in archive page that have relation with another taxonomy term
- Display category filters for custom post type when category is shared by multiple post types
- How do I find the count of the current post?
- get_queried_object not work in taxonomy page
- Get queried object for custom post type count
- How to show custom post count in archive page
- I have a problem with displaying children pages of custom post type
- Modify the category post counting function
- Columns depending on posts count
- conditional based upon the count of current user’s published custom posts
- Taxonomy count per Post type
- Counting custom post type with wp_count_posts returns an empty object
- How to add a post counter to the list of custom taxonomy terms?
- how to show Author post type count
- Complex Custom Loop with Includes
- Hide load more button if no more post in selected category
- How do test if a post is a custom post type?
- Where to put my code: plugin or functions.php?
- What does this PHP function code mean? [closed]
- Remove slug from custom post type post URLs
- How to disable the single view for a custom post type?
- Custom post types, taxonomies, and permalinks
- Query all posts where a meta key does not exist
- How to create a permalink structure with custom taxonomies and custom post types like base-name/parent-tax/child-tax/custom-post-type-name
- How to get all taxonomies of a post type?
- How to sort the admin area of a WordPress custom post type by a custom field
- How to create a custom search for custom post type?
- Deregister custom post types
- Can I assign a template to a custom post type?
- Permalinks: custom post type -> custom taxonomy -> post
- Should I use custom post types or a custom database tables for plugin development?
- Enable revisions for custom post type
- Extending the search context in the admin list post screen
- How do I query a custom post type with a custom taxonomy?
- Adding a Custom Post Type into the menu screen
- Pagination not working with custom loop
- How to Add Tags to Custom Post Type?
- How come Featured Image isn’t showing up in my Custom Post Type?
- Custom Post Type URL Rewriting?
- Add category base to url in custom post type/taxonomy
- Include custom taxonomy term in search
- Is It Possible To Add Custom Post Type Menu As Another Custom Post Type Sub Menu
- Adding ‘menu order’ column to custom post type admin screen
- Capabilities and Custom Post Types
- Can the Next/Prev Post links be ordered by menu order or by a meta key?
- what is the correct way to compare dates in a WP query_posts meta_query
- Use register_post_type() to modify an existing post type
- Custom Taxonomy specific to a Custom Post type
- Renaming Custom Post Types and Taxonomies
- List all posts in custom post type by taxonomy
- Redeclare/Change Slug of a Plugin’s Custom Post Type
- Allow member to have access to custom post type only. Permission to only edit their own posts
- Mixing custom post type and taxonomy rewrite structures?
- Advanced search form with filters for custom taxonomies and custom fields
- Highlighting wp_nav_menu() Ancestor Class w/o Children in Nav Structure?
- Resolve a custom post type name vs. page permalink conflict (same slug)
- Get custom post_type’s archive URL
- Enable Gutenberg on custom post type
- Is there a way to get N number of WYSIWYG editors in a custom post type?
- Can multiple custom post types share a custom taxonomy?
- How to Add Custom Fields to a Custom Post Type?
- Hook for post and page load
- How to enqueue scripts on custom post add/edit pages?
- How to display value of custom fields in page
- Where are wordpress custom types stored?
- Using save_post to replace the post’s title
- Custom Post Type pages are “not found”
- Possible to hide Custom Post Type UI/Menu from specific User Roles?
- How do I safely change the name of a custom post type?
- Custom post type single page returns 404 error
- Change “Enter Title Here” help text on a custom post type
- Hide content box with Custom Post Type?
- Change the text on the Publish button