Warning: This function has been deprecated. Use wp_set_post_categories() instead.

wp_set_post_cats() WordPress Function

The wp_set_post_cats() function is used to set the category for a post in WordPress. This function will take two parameters: the post ID and an array of category IDs.

wp_set_post_cats( int $blogid = '1', int $post_ID, array $post_categories = array() ) #

Sets the categories that the post ID belongs to.


Description

Top ↑

See also


Top ↑

Parameters

$blogid

(int)(Optional)Not used

Default value: '1'

$post_ID

(int)(Required)

$post_categories

(array)(Optional)

Default value: array()


Top ↑

Return

(bool|mixed)


Top ↑

Source

File: wp-includes/deprecated.php

function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array()) {
	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_set_post_categories()' );
	return wp_set_post_categories($post_ID, $post_categories);
}


Top ↑

Changelog

Changelog
VersionDescription
2.1.0This function has been deprecated. Use wp_set_post_categories() instead.
1.0.1Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More