I’m going to guess here. I assume you are using the Taxonomy Images plugin?
This:
if($term->term_id == $categories_item->term_id) {
Can be changed to:
if($term->term_id == $categories_item->term_id && $term->parent == $categories_item->cat_ID) {
Hereby, you check if the parent ID of the term
is the same as the ID of the categories_item
.
Related Posts:
- wp_update_nav_menu_item() to insert categories
- Question on using custom structures for categories
- How can I add HTML classes for current taxonomy/term hierarchy into my pages to simplify styles?
- Category base 404 – fix
- How to make /category/ URL load properly instead of 404 error?
- Is There a Difference Between Taxonomies and Categories?
- 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
- Control term order on a per-post basis
- How can I add the featured image functionality to a custom taxonomy?
- Share one taxonomy across multiple blogs in 3.0 [duplicate]
- Check if current category has subcategories
- wp_nav_menu not appearing for a couple pages
- Admin Panel – Disable Moving Selected Terms To Top of Metabox
- How to make custom taxonomy check boxes like ‘Categories’
- Create terms when registering taxonomy?
- How to create non-unique sub-category slugs?
- How to get next previous category in same taxonomy?
- Display only deepest category on a single post?
- Why adding Categories does not auto refresh in Backend while using my custom theme?
- How to add HTML5 ‘required’ attribute to wp_dropdown_categories() without JavaScripts?
- Wrap a chosen category name with div
- Does WordPress Offer a Way to Find All of the Categories that Don’t Have Children?
- wp_list_categories, Add class to all list items with children
- Display empty taxonomy terms with get_terms()
- is_archive() content being shown instead of is_category()
- Connecting WordPress gallery to custom categories (taxonomy)
- How to query posts from specific authors and categories using WP_query?
- New categories are now going to 404s
- Add custom taxonomy under the category title
- “Reversable” and “Re-useable” Subcategories (or other taxonomic structure)
- Get multidimensional array that reflects category hierarchy
- Retrieve all posts within tag OR category?
- List Terms in Category
- How to get category URL with the slug?
- New Theme creation
- How to get data about category in category.php
- editing fonts of category links from the_category() funtion
- Display Slug instead of Name
- Force a user’s posts category
- Search Posts / Pages with multiple options?
- ACF: Display category name using taxonomy field
- Taxonomy name repeating when showing 2 posts from each category
- New Categories Not Shown In the Post Edit Page
- Different templates for different category tags
- Shortcodes not working in category or tag description
- Filtering multiple categories via the URL
- Display specific categories by ID
- Why category.php throw 404 in wordpress while calling paginate_links()?
- Display Posts Loop for each parent and for each Child
- Why don’t posts show up in my categories on the frontend?
- Flat category URLs but retaining hierarchy?
- How many categories can WordPress handle before performance suffers?
- Custom taxonomy template for categories
- Targeting Parent Category Pages
- Wacky taxonomy in wordpress
- How to modify the output of wp_terms_checklist when used within the built-in category metabox on edit posts?
- Some categories missing on wp-admin/edit-tags.php?taxonomy=category
- List just subcategory and products of active category page in Woocommerce
- Eliminate word from $term->name
- How do I retrieve the category ID (ugly permalinks) in my sub-navigation menu?
- Category page returns 404 error
- How to schedule categories?
- Show post categories
- Add description to categories menu in admin
- filter a loop base on specific category
- Problem with multiple loops in wordpress theme
- Copy post taxonomy?
- How to differentiate the homepage structure from the category page structure in WordPress template?
- Setting selected term_id with wp_dropdown_categories?
- creating categories programmatically
- Combining these queries? (Same taxonomy term + same category as post)
- Category post count is not correct
- Disable Category Taxonomy
- How do I edit the terms output args or array data?
- How can i change sort category view starting from child then parent, not alphabetically
- Products category search not working
- In if…else condition, the else statement shows even if if statement is correct
- Filtering posts in category by tag URL
- Bulk assign posts to a category using SQL (MySQL)
- Image Upload Custom Form Field for Category and Custom Taxonomy
- outputting taxonomy hierarchy
- Filter custom taxonomy posts via AJAX
- Why use hierarchical taxonomies instead of many custom taxonomies?
- How get all media from a posts category by db?
- Show posts from all categories
- Grouping parent categories into sections
- If it is a top level category show children otherwise show sibling categories
- get_adjacent_post_link excluded_terms ignored
- Match two taxonomies to display a specific content
- Taxonomy for custom post type not found
- How to get multiple loop in category.php, my scripts becomes madness
- altering theme – content generated by PAGES not PORTFOLIO
- Return selected categories only in custom page meta box?
- Assign a category by user and customize the edit-tags.php?taxonomy=category page
- Chained drop-down menu for custom taxonomy using chained.js
- WordPress 3.5 how to determine if user is on category listing or category edit screen?
- How to display the category featured images [closed]
- Woocommerce custom taxonomy order
- Hook action when create new category [duplicate]