wp_add_post_tags

The timeline below displays how wordpress function wp_add_post_tags has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Adds tags to a post.
 *
 * @see wp_set_post_tags()
 *
 * @since 2.3.0
 *
 * @param int          $post_id Optional. The Post ID. Does not default to the ID of the global $post.
 * @param string|array $tags    Optional. An array of tags to set for the post, or a string of tags
 *                              separated by commas. Default empty.
 * @return array|false|WP_Error Array of affected term IDs. WP_Error or false on failure.
 */
function wp_add_post_tags($post_id = 0, $tags = '')
{
    return wp_set_post_tags($post_id, $tags, true);
}

WordPress Version: 4.4

/**
 * Add tags to a post.
 *
 * @see wp_set_post_tags()
 *
 * @since 2.3.0
 *
 * @param int          $post_id Optional. The Post ID. Does not default to the ID of the global $post.
 * @param string|array $tags    Optional. An array of tags to set for the post, or a string of tags
 *                              separated by commas. Default empty.
 * @return array|false|WP_Error Array of affected term IDs. WP_Error or false on failure.
 */
function wp_add_post_tags($post_id = 0, $tags = '')
{
    return wp_set_post_tags($post_id, $tags, true);
}

WordPress Version: 4.3

/**
 * Add tags to a post.
 *
 * @see wp_set_post_tags()
 *
 * @since 2.3.0
 *
 * @param int    $post_id Optional. The Post ID. Does not default to the ID of the global $post.
 *                        Default 0.
 * @param string $tags    Optional. The tags to set for the post, separated by commas. Default empty.
 * @return array|false|WP_Error Will return false if $post_id is not an integer or is 0.
 */
function wp_add_post_tags($post_id = 0, $tags = '')
{
    return wp_set_post_tags($post_id, $tags, true);
}

WordPress Version: 4.0

/**
 * Add tags to a post.
 *
 * @see wp_set_post_tags()
 *
 * @since 2.3.0
 *
 * @param int    $post_id Optional. The Post ID. Does not default to the ID of the global $post.
 *                        Default 0.
 * @param string $tags    Optional. The tags to set for the post, separated by commas. Default empty.
 * @return bool|null Will return false if $post_id is not an integer or is 0. Will return null otherwise.
 */
function wp_add_post_tags($post_id = 0, $tags = '')
{
    return wp_set_post_tags($post_id, $tags, true);
}

WordPress Version: 3.9

/**
 * Adds tags to a post.
 *
 * @uses wp_set_post_tags() Same first two parameters, but the last parameter is always set to true.
 *
 * @since 2.3.0
 *
 * @param int $post_id Post ID
 * @param string $tags The tags to set for the post, separated by commas.
 * @return bool|null Will return false if $post_id is not an integer or is 0. Will return null otherwise
 */
function wp_add_post_tags($post_id = 0, $tags = '')
{
    return wp_set_post_tags($post_id, $tags, true);
}

WordPress Version: 3.7

/**
 * Adds tags to a post.
 *
 * @uses wp_set_post_tags() Same first two parameters, but the last parameter is always set to true.
 *
 * @package WordPress
 * @subpackage Post
 * @since 2.3.0
 *
 * @param int $post_id Post ID
 * @param string $tags The tags to set for the post, separated by commas.
 * @return bool|null Will return false if $post_id is not an integer or is 0. Will return null otherwise
 */
function wp_add_post_tags($post_id = 0, $tags = '')
{
    return wp_set_post_tags($post_id, $tags, true);
}