Set tags for a post. Every tag that does not already exists will be automatically created. Uses wp_set_post_terms().
Usage
wp_set_post_tags( $post_ID, $tags, $append )
?>
Parameters
$post_ID
(integer) (required) Post ID.
Default: 0
$tags
(string,array) (optional) List of tags. Can
be an array or a comma separated string.
Default: array
$append
(boolean) (optional) If true, tags will be appended
to the post. If false, tags will replace existing tags.
Default: false
Return values
(boolean|null)
Will return false if $post_id is not an
integer or is 0. Will return null otherwise.
Examples
To add the tags meaning and life to the current tags of the post with ID 42:
wp_set_post_tags( 42, 'meaning,life', true );
More informations: http://codex.wordpress.org/Function_Reference/wp_set_post_tags


Leave a comment