Skip to content

Instantly share code, notes, and snippets.

@spencejs
Created April 25, 2013 06:06
Show Gist options
  • Save spencejs/5457826 to your computer and use it in GitHub Desktop.
Save spencejs/5457826 to your computer and use it in GitHub Desktop.
Deepest Level Category
//Deepest Level Category
function get_deep_child_category( $categories )
{
$maxId = 0;
$maxKey = 0;
foreach ( $categories as $key => $value )
{
if ( $value->parent > $maxId )
{
$maxId = $value->term_id;
$maxKey = $key;
}
}
return $categories[$maxKey];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment