Get parent category id from child category page for custom taxonomy
I have created the custom taxonomy for categories. I want to list the child categories lists of current parent category in child page.
$cateID = get_queried_object_id();
$args = array(
'format' => 'name',
'separator' => ' ',
'link' => false,
'inclusive' => true
);
$checkparent = get_term_parents_list(
$cateID, 'my-taxonamy' , $args
);
I have tried the above code. But the code returns the parent category name/link. Any way to get the parent category id in child category page? Any methods or hooks are there in wordpress for getting the parent category id?
Example case:
- Parent category1
- Child category1
- Child category1
- Child category3
- Parent category1
- Child category1
- Child category1
If i am in child category1 page, want to list the below categories.
- Child category1
- Child category1
- Child category3
Problem:
I cannot able to get the parent category id from the child category.
Thanks in advance 😉
Leave an answer