2015-09-16 105 views

回答

0

試試這個

function add_my_tag($id,$post) 
{ 
     wp_set_post_tags($id, str_replace(',', ' ', $post->post_title), true);  //if last argument is false, this will replace current tags, if it's true, it will append. 
} 
add_action('publish_your-cpt', 'add_my_tag', 7,2); 
+0

我試過,但它無法正常工作。 – user1460618

+0

你確定你用自己的自定義帖子類型替換了'your_cpt'嗎? –

+0

是的,我敢肯定... – user1460618

相關問題