wp_add_post_tags()
Adds tags to a post.
No Hooks.
Return
Array|false|WP_Error
. Array of affected term IDs. WP_Error or false on failure.
Usage
wp_add_post_tags( $post_id, $tags );
- $post_id(int)
- The Post ID. Does not default to the ID of the global $post.
- $tags(string|array)
- An array of tags to set for the post, or a string of tags separated by commas.
Default: ''
Notes
- See: wp_set_post_tags()
Changelog
Since 2.3.0 | Introduced. |
wp_add_post_tags() wp add post tags code WP 6.5.2
function wp_add_post_tags( $post_id = 0, $tags = '' ) { return wp_set_post_tags( $post_id, $tags, true ); }