Did this before for a website. Here's what i did: Checked if there is a category with the same name as the title: >if( term_exists(get_the_title(), 'category' )) If there was one then I got the category by slug: > $cat = get_term_by("slug", $post->post_name, "category"); Checked if category had parent or was a parent: > if($cat->parent !== 0) { $catID = $cat->parent; } else { $catID = $cat->term_id; } Then retrieved categories by said parent: > $args = array( 'type' => 'post', 'child_of' => $catID, 'hide_empty' => false, 'hierarchical' => true, 'exclude' => '1' ); $categories = get_categories($args); Then a simple loop with links: > foreach($categories as $categorie) { if($categorie->slug == $post->post_name) { $clasa = "class='current'"; } else { $clasa = ""; } echo "<a ".$clasa." href='".home_url("/").$slug."/".$categorie->slug."'>".$categorie->name."</a>"; } Hope this is what you are looking for.