As pointed out by @Jagst3r15, you’re going to have to loop through each category’s posts no matter what to filter out those posts that hold your meta key.
For a high-level answer: I’d suggest looking at the INNER JOIN
logic that happens in _pad_term_counts()
for an example of how to bring in the posts table. Then filter on the get_terms
hook to loop through those results and exclude what you don’t need.
It’s a good question with a not-very-simple answer, unfortunately.
Related Posts:
- Order get_terms() By Custom Field
- get_field not displaying my custom field value
- Add extra fields to Add New Category page
- Need help adding custom field to category
- adding custom fields to next and previous post link
- Custom query with category exclusion and post-meta “whitelist”
- Sort category page with custom field
- Create a full width responsive header image per page
- Return category slug / title from category ID
- How to put enctype=”multipart/form-data” in categories form?
- Add custom taxonomy under the category title
- How to call custom category field data in theme?
- query in category.php repeats itself
- need to add custom field in more products
- Retrieving category’s color with get_term_meta
- How to change a post category when the ACF datepicker Field is today
- Listing Texts of Which Custom Field is Null
- How to “group” (categorize) the Pages together?
- How to query categories with Advanced Custom Fields?
- How to add custom color fields to the category edit page?
- Notice: Trying to get property of non-object in : custom fields category
- echo get_post_meta of all post in a category to fill up a select field
- “Virtual category page” based on a custom field filter
- ACF no print data [closed]
- Displaying a custom field in Category Archives
- Assign a custom post to a custom taxonomy based on custom field value
- Custom Fields Value As Taxonomy
- Update custom category fields front-end
- What is the best way to add an advanced / intermediate / beginner tag to a post
- Show posts from category specified using a custom field
- Adding tinymce to Custom Field boxes on Category edit page
- How can i add service category here? [duplicate]
- Sort categories by custom field in WordPress admin
- Modifying category order
- Displaying data from custom fields on a specific category page
- How can I add different custom fields for each category in the same post?
- How to display custom fields as table in Woocommerce
- How to modify custom category field from front end?
- Ajax Category add doesn’t update the list table custom column
- How to Manage and link certain custom taxonomy?
- Custom field picture instead of post thumbnail on category page
- How to loop through a custom field for each post, & display?
- $args Orderby The number
- ACF plugin categories bug in WordPress 3.9
- Formating content in category.php
- Logic for Nearby places with post and categories
- Sort categories by meta value
- How to structure Multisite sites into categories?
- Custom Fields to Category edit page, then displaying them in a template correctly
- How do I add and display a custom image field to a category? [duplicate]
- Converting Categories (with ACF fields) to custom taxonomies
- How Do I Add HTML Support to the Additional Category Description Field?
- Add custom text in second paragraph of posts in specific category
- Display all posts from all categories with pagination
- Remove “Category Archives: title” at the top of a category page [duplicate]
- WooCommerce – Display product child categories from specific parent
- Display empty taxonomy terms with get_terms()
- Show list of categories even if they have no posts
- How can I show the subcategories content on the parent category page?
- How to control template resolution if both Author and Category filter in place?
- Custom Stylings for category pages
- If newest post of category is newest post in general, skip first post of category
- Taxonomies for WordPress Media Library [duplicate]
- Query posts by category AND custom field, then ORDERBY another custom field – help!
- How to enable category hierarchy for links?
- WC 3.x Get categories from variable product of the cart
- Stick multiple posts in a single category
- Automatically adding categories and authors in custom menu?
- Second level subcategory
- Checkboxes in the category list?
- Automatically exclude categories from metabox based on title
- How to display post categories within the Latest Posts block?
- Use Tag input metabox style for Categories
- Does “show_option_all” in wp_list_categories do anything?
- redirecting from a general category page to another specific one
- How to do paging in the loop?
- query_posts not reading correct categories
- Eliminate word from $term->name
- Is there any way to check which wordpress categories was created by which user?
- Category view with contents of [gallery]s shown
- How can I include custom category and tag base in template files?
- query_post problem
- Get a list of all links on a page?
- Is this process OK to replace URL structure?
- how to give different template to each subcategory from same parent category?
- No hierarchy in wp_list_categories with child of and depth
- How to check a category checkbox using JavaScript
- Need help to structure our a complex hierarchy
- global categories – Share specific categories in wordpress multisite
- WordPress update 4.7 – the 70.000+ news posts became “Uncategorized”
- How Can Hide Define Category in Post Contents?
- How to auto update post title and slug with category name when post status is updated
- 404 error when i try to search by category or by tag
- Choosing different templates for categories
- Problem with wp_list_categories
- hierarchical taxonomy in permalinks? using same slug
- WordPress Numeric Pagination with Query String [duplicate]
- Changing Permalinks for Category Pages Only
- Taxonomy for custom post type not found
- Sorting Woocommerce products by category and attributes