Category Exists

<?php if(check_if_cat_exists('uncategorized')) echo "Category Exists"; ?>

function check_if_cat_exists($category_name){
$category_to_check = get_category_by_slug($category_name);
if (!empty($category_to_check)) return true;
}

0 Comments

You must be logged in to post a comment.