I think I’d setup a loop for all posts and the do something like this inside the loop:
$post_cats = get_the_category();
$brand_cats = 0;
$retail_cats = 0;
foreach ( $post_cats as $post_cat ) {
if ($post_cat->category_parent == 187) {
$brand_cats++;
if ($post_cat->category_parent == 186) {
$retail_cats++;
}
}
if ( $brand_cats > 1 )
echo "Duplicate Brand for Post #".get_the_ID;
if ( $retail_cats > 1 )
echo "Duplicate Retailer for Post #".get_the_ID;
The code is untested but should give you the general approach.
Related Posts:
- get complex results set according to category structure
- display all posts from category with and without terms in chronological order
- Nested meta_query with multiple relation keys
- Multiple relationship for multiple tax_query in WP_Query
- WordPress tax_query “and” operator not functioning as desired
- Exclude or Include category ids in WP_Query
- Conditional arguments for WP_Query and tax_query depending on if $somevar has a value
- How to query only for products with status “in stock” in WooCommerce? [closed]
- WP_Query to show post from a category OR custom field
- Escaping WP_Query tax_query when term has special character(s)
- Does tax_query really beats meta_query in all situations?
- get_posts with multiple categories
- Tax_query terms ID’s using variable
- ajax category filter
- Display recent posts from the same category as current post in sidebar
- Why is my WP_Query not working when tax_query terms are an array?
- How to filter by category in REST API, excluding posts also in other category term?
- Counting number of posts with Category B in Category A
- How to order category.php loop by ‘meta_value’?
- if wp_query taxonomy term have posts
- Use Transient API to cache queries for all posts in all categories?
- How can I display recent posts from a particular category in my header?
- Sorting Posts by custom field
- WooCommerce: filter by parent product’s taxonomy and product variation’s meta data
- How to combine tax_query and date_query in WordPress
- Querying by taxonomy vs Querying by Custom fields Speed Comparison
- How to extend tag and category “Related Posts” query to custom post_type if the first 2 terms have no posts
- Using tax_query reverses my post_type argument in a custom WP_Query
- WP Query for Posts (Products) in Specific Category that has 2 Specific Tags (*AND* both tags not *OR*)
- Find all product that contain terms with %keywords% in WP_Query
- Get term by custom term meta and taxonomy
- WP Query with multiple categories – passing an array works?
- wp_query display posts from same category of the post
- How to show only one post for each categories of taxonomy of custom post that contains a specific custom field
- WP_query category__in not working, only pulls from first category
- tax_query shows no results if nothing is selected
- WP_Query order by date in meta_value
- How get posts from a subcategory of a category by name?
- WP_Tax_Query with post_tag not working
- WP_Query tax_query problem
- How to add terms to my tax_query based off of the current post
- Searching through different categories on different pages code is not working
- Query all posts in a given taxonomy
- Get image of latest post from taxonomies/categories
- How To Remove/hide some specific categories from two different categories widget from sidebar
- Change default ordering of taxonomy terms – pre_get_terms
- tax_query OR with empty result returns all posts
- How to select posts from one category but exclude posts in another category?
- WP_Query, tax_query and term_meta: How to?
- Is it possible to dynamically get queried term AND taxonomy?
- Empty tax_query array returns an empty array
- How can i simulate “taxonomy__in” in query?
- Get Category Archive Template Name Dynamically
- WP_Query arguments to fetch custom post type posts which are in certain category?
- How do I reset this wp_list_categories query?
- Get list of terms that have posts in another term
- How can you get first post, last post and post count in a category?
- How to get count of posts assigned to given category?
- pre_get_posts Remove tax_query Completely
- tax_query: Order by slug?
- How to show subcategories using loop?
- Meta Query relation “AND” not working
- Tax query clause inside a meta query clause?
- List of the years with posts presented
- Nested tax_query that allows specified categories OR tags, but NOT other categories
- Remove a specific category ID from related post
- Complex Category selection as per user input
- Show all post for a given category
- Querying on multiple taxonomies pulled from $_GET checkbox array not working?
- Five posts from a category in footer
- Populate tax_query terms parameter with post term
- How to get all unique categories for posts in loop?
- Fastest way of counting posts of a custom post type in a specific taxonomy term?
- Display Featured Post by Categories and Avoid duplicated posts
- Cluster WooCommerce products in each Category Archive by Tags assigned to products
- Fetch posts that match term slug first two letters (wp query)
- Category applied to pages, creates multiple breadcrumb entries after a search query (On the translated site)
- category query for pages not working
- Is it a good idea to improve meta query performance by adding tax query?
- WP_Query | Tax_Query Relation | Unable to use ‘OR’ as it then allows all products, help me finish my query?
- WP_Query tax query part of slug
- Can we return all category (not post) with Custom Query Filter? [closed]
- Taxonomy Query Relation field not behaving correctly?
- Query posts intersecting tags and categories
- Tax query AND/OR meta query [duplicate]
- Query posts from category A, and from either category B or C
- Search Query for multiple categories using ‘OR’ but having certain categories be ‘AND’
- Combining categories (Query posts with multiple taxonomy terms)
- Check if loop has any categories?
- Filtering out child category posts from parent category archive not working
- Exclude Category filter from Portfolio section
- Inserting HTML to close and open divs in WP_Query loops
- Limiting number of related posts
- Category ‘pad_counts’ & ‘parent’ conflict
- Query with meta_query and tax_query together not working properly
- Adding a tax_query to a WP_Query Object
- Include posts from some categories while excluding from others
- Order or Orderby in tax_query (How to define order of terms in WP_Query)
- Combine results of multiple WP_Query to resemble single WP_Query
- WordPress Custom Search Form Displaying Unexpected Results