Want to get parent ID when on the current post of
Created a custom post type and custom taxonomies for that post type.
Created a category and assigned another category to have the first category as a parent.
I'm listing all posts of that parent category on the parent category page when a particular post is clicked it opens the
single-custom_post_type.php and want to get the parent category ID on the
single-custom_post_type.php so I can add a sidebar with all the sibling's post with the same parent category.
$args_docs = array( 'post_type' => Documents::DOCUMENTS_TYPE_KEY, 'posts_per_page' => -1, 'tax_query' => array( array( 'taxonomy' => DocumentsTaxonomy::DOCUMENTS_TAXONOMY_KEY, 'field' => 'term_id', 'terms' => 9, // <- I want here to add the parent category ID dynamically,so whenever we are currently on a post it gives that posts parent category ID ), ), );