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
- How to create an automatic MultiColoumn MegaMenu with Categories WordPress
- Is There a Difference Between Taxonomies and Categories?
- Adding Fields to the Category, Tag and Custom Taxonomy Edit Screen in the WordPress Admin?
- List all subcategories from category
- How To Find Out WordPress Category Table in MYSQL?
- Add custom field to Category
- Get Category ID inside Category template
- Only one category per post
- WordPress Multisite – global categories
- Get the children of the parent category
- Get posts from sites in Multisite?
- WP REST API: filter by category 1 AND category 2
- How To Get Parent Category Slug of Current Post
- Display All Products by Category with WooCommerce
- What is the difference between a “tag” and a “category”?
- Is there an easy way to make a meta box have the tabs like the Categories meta box has?
- How to check if I’m on the last page of posts?
- Display posts from the same category using next/previous post link
- How would I get a taxonomy/category list inside a Gutenberg block?
- Can I set a default featured image for a category?
- Check if a post is in any child category of a parent category
- How to export and import taxonomies (category, tag and/or custom taxonomy) and their terms
- Force category choice before creating new post?
- Gutenberg editor add a custom category as wrapper for custom blocks
- WooCommerce: List All Categories
- How to get category and archive title?
- Get category ID from category slug (not working)
- How do I remove “Uncategorized” from posts with more than 1 category?
- Get rid of WordPress category, tag and author archives?
- Individual rss feed entry length for categories?
- How can I create a category landing page followed by pages of posts?
- Remove parent category from permalink? Basically only have the child category?
- Custom permalink structure leads to be 404 on pagination
- Retrieve Product category ‘NAME’ by product category ID – WooCommerce?
- Posts URL structure like site.com/category/the-post-title
- Can’t custom taxonomies have same terms (slugs) as categories?
- How to get permalinks with category base working with sub-categories
- How to remove the term “category” from category pagination?
- Using wp_category_checklist in a widget
- WP 3.9 TinyMCE no longer loads on category description editor
- On the category page, get the category object
- Get only the top level categories using get_categories() without foreach loop
- Get all categories and posts in those categories
- How to add featured image for category (without a plugin)?
- How to create a custom sort for WordPress categories
- How to display non-hierarchical taxonomy as terms with checkboxes?
- Category archive by year with permalink support /category/YYYY