In the PHP function below, I want to exclude cat_ID=1
How can I do it?
function get_cats(){
$post_cats= array();
$categories = get_the_category();
foreach($categories as $cat){
array_push($post_cats, $cat->cat_ID);
}
return $post_cats;
}
get_the_category() returns an array of all the categories that the current post is assigned to
1 Answer