Codex

Function Reference/wp set post categories

This article is marked as in need of editing. You can help Codex by editing it.

Contents

Description

Set categories for a post.

If the post categories parameter is not set, then the default category is going used.

Usage

<?php wp_set_post_categories$post_ID$post_categories ?>

Parameters

$post_ID
(integer) (optional) Post ID.
Default: 0
$post_categories
(array) (optional) List of categories.
Default: array

Return Values

(boolean|mixed) 

Examples

Notes

Change Log

Since: 2.1.0

Source File

wp_set_post_categories() is located in wp-includes/post.php.

Related