Definition:
function wp_create_categories($categories, $post_id = '') {}
Parameters
- unknown_type $categories
- unknown_type $post_id
Source code
function wp_create_categories($categories, $post_id = '') {
$cat_ids = array ();
foreach ($categories as $category) {
if ($id = category_exists($category))
$cat_ids[] = $id;
else
if ($id = wp_create_category($category))
$cat_ids[] = $id;
}
if ( $post_id )
wp_set_post_categories($post_id, $cat_ids);
return $cat_ids;
}
3505

February 12, 2011 


No comments yet... Be the first to leave a reply!