wp_update_category

Definition:
function wp_update_category($catarr) {}

Aliases wp_insert_category() with minimal args.
If you want to update only some fields of an existing category, call this function with only the new values set inside $catarr.

Parameters

  • array $catarr: The ‘cat_ID’ value is required. All other keys are optional.

Return values

returns:The ID number of the new or updated Category on success. Zero or FALSE on failure.

Source code

function wp_update_category($catarr) {

	$cat_ID = (int) $catarr['cat_ID'];



	if ( isset($catarr['category_parent']) && ($cat_ID == $catarr['category_parent']) )

		return false;



	// First, get all of the original fields

	$category = get_category($cat_ID, ARRAY_A);



	// Escape data pulled from DB.

	$category = add_magic_quotes($category);



	// Merge old and new fields with new fields overwriting old ones.

	$catarr = array_merge($category, $catarr);



	return wp_insert_category($catarr);

}

4213

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: