Advertisements

wp_create_categories

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

Advertisements

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: