Skip to content

Instantly share code, notes, and snippets.

@namncn
Created December 11, 2022 02:54
Show Gist options
  • Save namncn/957ef04d539e43e63f10f1eda74848c7 to your computer and use it in GitHub Desktop.
Save namncn/957ef04d539e43e63f10f1eda74848c7 to your computer and use it in GitHub Desktop.
How to get taxonomy/category direct children only
<?php
$args = array(
'taxonomy' => 'product_cat', // truyền category/custom taxonomy name vào đây.
'parent' => get_queried_object_id(),
);
$getterms = get_terms( $args );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment