Get parent category id from child category page for custom taxonomy

Question

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:

  1. Parent category1
    • Child category1
    • Child category1
    • Child category3
  2. 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 😉

0
, , , Rajkumar S 4 years 2020-03-05T07:51:14-05:00 0 Answers 87 views 0

Leave an answer

Browse
Browse