wp_set_post_terms


wp_set_post_terms ( $post_id = 0, $tags = '', $taxonomy = 'post_tag', $append = false )

Parameters:
  • (int) $post_id Optional. The Post ID. Does not default to the ID of the global $post.
  • (string|array) $tags Optional. An array of terms to set for the post, or a string of terms separated by commas. Hierarchical taxonomies must always pass IDs rather than names so that children with the same names but different parents aren't confused. Default empty.
  • (string) $taxonomy Optional. Taxonomy name. Default 'post_tag'.
  • (bool) $append Optional. If true, don't delete existing terms, just add on. If false, replace the terms with the new terms. Default false.
See:
Returns:
  • (array|false|WP_Error) Array of term taxonomy IDs of affected terms. WP_Error or false on failure.
Defined at:

Description

Set the terms for a post.

Related Functions

wp_get_post_terms, wp_set_post_cats, wp_set_post_tags, wp_set_object_terms, wp_set_post_categories

Top Google Results

User discussions

wpseek mobile