please help about post_category
-
Hello,
I want to add more than one term_id like
$articleOption[‘post_category’] = array(1,2,3,4,5);
there is a array like
$arr[0] = "0"; $arr[1] = "1"; $arr[2] = "2";although the $category output is like 1,2,3, it doesnt work
$category = implode(",", $arr); $articleOption['post_category'] = array($category);However it is work;
$cnt = count($arr); if($cnt=1) $articleOption['post_category'] = array($arr[0]); if($cnt=2) $articleOption['post_category'] = array($arr[0],$arr[1]); if($cnt=3) $articleOption['post_category'] = array($arr[0],$arr[1],$arr[2]); if($cnt=4) $articleOption['post_category'] = array($arr[0],$arr[1],$arr[2],$arr[3]); if($cnt=5) $articleOption['post_category'] = array($arr[0],$arr[1],$arr[2],$arr[3],$arr[4]); if($cnt=6) $articleOption['post_category'] = array($arr[0],$arr[1],$arr[2],$arr[3],$arr[4],$arr[5]);So I think it just accept integer one by one.
How can I get rid of these if conditions ?
please help methanks..
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
The topic ‘please help about post_category’ is closed to new replies.