[Tip] Check if category has children


Sep 05

If you looking forward checking if a certain category has children or not , simply do this

	$categories = get_categories( "parent=$cat_id&hide_empty=0" );
	if(empty($categories)) {
		// what if has no children
	} else {
		// what if has children
	}

don’t forget replacing $cat_id with the category id you want to check .


Leave Your Own Comment on This Post

Spam protection by WP Captcha-Free




Copyright © 2012 Banhawi & web design egypt