使用PHP [Wordpress]插入标签


Insert tags with PHP [Wordpress]

我想知道是否有可能将标签添加到文章中,而不是使用后台,而是使用php ?

感谢您的回复!

wp_set_post_tags就可以了

wp_set_post_tags( 42, 'meaning,life', true );

wp_set_post_tags( $post_ID, $tags, $append )

地点:

$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

下次,用谷歌搜索你自己。div;)