I would do something like this:
$categories = get_categories($args);
foreach ($categories as $category){
if ($category->parent != $get_id_parent_cat->term_id){
//Do stuff with the category
}
}
Related Posts:
- How to display non-hierarchical taxonomy as terms with checkboxes?
- Different template for subcategories
- Categories’ hierarchy in URL
- How to only show posts on last child category
- Categories lose hierarchy order once assigned to post
- Add Product categories to WordPress menu without losing hierarchy
- How can I get an tag to wrap each ancestor that gets outputted in this condition?
- how to get the categories for a single post in a hierarchical way
- Category tree is flattened inside admin upon saving
- Categories vs. Page Site Organization
- How to enable category hierarchy for links?
- Combining post categories and link categories?
- How to categorize posts under Category 1 and Category 2 which are separate lists of categories, and display them as separate lists in widgets
- Give a page priority over a category that has the same name?
- Add child category to parent on post creation and save
- How do I make the category sidebar widget (stock) display the total # of posts including those in subcategories?
- How to get Next/previous_post_link to go through articles in top parent category
- Hierarchical permalink structure for posts showing categories and sub-categories
- WordPress list categories dropdown with parent-child relation and child under it’s parent
- How to load several hierarchical categories from functions.php
- Check is category parent with ids from the childs – get_term_children
- Posts not listing out sub category in hierarchy
- list all child categories that apply to current post even if those cats are empty?
- Show subChild categories
- Parent Category and Subcategory default text generated with category
- outputting taxonomy hierarchy
- Different template for subcategories
- Children categories not shown in dashboard
- Most efficient use of custom taxonomies, categories, and pages
- Display categories and their IDs
- List the category tree of all the product_cat categories
- Main menu not appearing on category pages
- Using URL parameters, list posts from category and custom taxonomy
- Display posts links from a category group by year
- List categories for author: list_categories function inside list_authors function
- Hide a certain category name without removing it?
- strip last comma from get_the_category
- Exclude a category from the filed under list only on some templates
- has_category() for parent category
- Getting the sub category
- How to insert category and subcategory using ‘wp_insert_post’ function?
- Show posts of category in a page
- How to create taxonomy values for pages and list them in wp-admin
- display woocommerce all category title on home page
- When to use ‘get_category_by_path’ vs. ‘get_term_by’ to get category object from `get_query_var( ‘category_name’ )`?
- One WP install, I need to map a custom domain name to each category
- Show thumbnail for category?
- get_the_category_list() does not give me all my categories
- How to disable category without deleting?
- Displaying multiple loops based off of category
- Limit number of terms that a custom taxonomy can save per custom post type
- Category pie diagram meta box in post editing page
- There any way to get de percentage of number of post by user and category?
- Add tag parameter to category.php
- Why custom taxomony not showing when create a post?
- wp_list_categories with show_count, except for specific categories
- Adding a H1 Tag to Post Tags automatically, but hide the tag? (Same for Category)
- How do I add a category to my post_type
- Have posts that belong to multiple categories, exclude some categories from homepage
- Only first category!
- How could I write a get_categories_by_year() function?
- How to add icon over specific thumb
- add_settings_field (exclude categories->reading) wp_category_checklist
- Retrieve post tags from from main wp_query
- Listing Post Categories on Home Page
- Get posts in a subcategory of a chosen parent
- How can I only display links from a child category
- Category Template – Show Last Entry as Featured
- How to set the same base url for two different taxonomies?
- Hide category name but show posts
- Count how many posts have a specified tag AND category
- Show the parent taxonomy by creating shortcode in woocommerce?
- Post List by category and under custom taxonomy
- Balance Tags to the_content Words Length
- How to create template for children category?
- Using a template page parent breaks page
- Categories and Tags Conflict after Woocommerce Installation
- Setting category for post as default
- Query post only from categories that have subcategories
- How to get the link of all categories
- Show parent category if there is no subcategory
- foreach,having wp_query inside, breaks after showing one result
- Display a category name automatically using code in the functions.php file
- Removing categories, Comments etc from posts?
- Include Category Description in search result
- Problem importing categories and sub-categories
- how to ask if in two categorys inside if
- All post of child category not in top category
- How to add a tag above a category post that displays the category name in WordPress
- Woocommerce – Display product category of product in Orders page
- How to show video from wp option value?
- Changing Woocommerce categories programatically
- Add an Exclusive or featured tag line to article titles
- How to list out post category name and description in page
- Print child category slug nicename
- Order Categories by Character Count
- Can’t filter categories using isotope
- Hide product categories if empty by leaving them positioned in the same place in the menu
- WP_Query with multiple categories unexpected behavior
- What would be the easiest way to show subcategories under specific parents as text links only?