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
- Front end post editing using a form
- Set relationship between custom_post_types
- How to add relationships between custom post types?
- Custom taxonomy query for a custom post type
- Get the ‘slug’ of a custom taxonomy
- post_type_link filter causes 404 on the CPT page it’s used on
- Show certain terms from custom taxonomy but exclude ‘parent’ terms?
- Add special meta box to custom post type
- Custom Taxonomy conditionals
- Possible to change the slug of default post type?
- Function tied to woocommerce_payment_complete_order_status blocks “processing” order status
- Multisite Global Custom Posts
- Custom post type – posts list – white screen of death
- Display only post types that are direct children of the current taxonomy
- Getting the URL of the parent page
- Custom Taxonomy Invalid in REST API
- How to Display child post on his parent post with thumbnail and content in WordPress
- Append date to custom post type url slug
- Custom Post Type Archive Page Filtering
- How to move image thumbnails into custom folder for custom post type
- Missing Posts in Custom Taxonomy List
- Custom post content to display in a normal post?
- Insert Custom Post Type data from the front-end by a user
- Seamless permalinks between Custom Taxonomy and Custom Posts
- How to integrate a form (Ninja Form or Contact Form 7) with Custom Post Types?
- Path to custom post type
- Multisite: How to define and limit a Custom Post Type to specific sites?
- Unable to set featured image
- How to display CPT archives?
- Save and user submitted data from a form and display them in the wp backend
- WordPress different templates for same type custom post (but different slug)
- Custom Post Type Advanced Slug
- Can I change the page of a Custom Post Type slug?
- Update Post Status On Woocommerce Payment Complete
- Should putting custom code in functions.php or created the plugins [duplicate]
- Saving meta box data?
- Create an user checklist system for a course plateform using ACF Pro and ACF Extended
- CPT archive with WP native/core tax/categories
- Create custom post type inside other post type
- On saving Post My permalink is updated and category is removed automatically which cause the 404
- How get list of job types of simple job board plugin from code?
- Changing permalink of default Post with custom post
- Post Click Redirect to Custom URL instead of Single Post Page
- wp_insert_post deleting previous post custom meta
- custom post type single page
- custom post type single post preview for pending status
- Reuse the “category” slug for a custom post type
- Submit and edit font end custom post type
- Importing URLs of Audio Enclosures
- Create 2-layered dropdown menus for custom taxonomy and custom post type
- Popup panel is only displaying 1 entry ignoring all others
- Fetch post meta in the same query as the main loop
- Archive.php is not displaying tags
- Get all custom_post_type posts + blog posts from one category in a single query
- How to turn custom-post archive into an overview page, listing the metadata of the posts?
- How is get_the_author connected to a custom post type?
- Get custom post type parent category
- add_filter > posts_where works partially