関数名がズレてたので追記しておきます。
function xxx_set_tags($post_id){
$content_post = get_post($post_id);
$content = $content_post->post_content;
if(strpos($content, '★特定の文字列★') !== false){
wp_add_post_tags($post_id, '★指定したタグ★');
}
}
add_action('save_post', 'xxx_set_tags');
@gblsm さん
以下のように直したら期待通りの動きになってくれました!
ご教示ありがとうございました。
function xxx_set_tags($post_id){
$content_post = get_post($post_id);
$content = $content_post->post_content;
if(strpos($content, '★特定の文字列★') !== false){
wp_add_post_tags($post_id, '★指定したタグ★');
}
}
add_action('save_post', 'mtc_set_tags');
@ishitaka さま
ありがとうございます!!
試してみたところ、希望通りの動きになってくれました・・!
とても困っていたので、非常に助かりました。
ishitaka様、gblsm様
早速の回答ありがとうございます!
すごくスマートで参考になりました。
まさか一日で解決できるとは思っていなかったので感激です。
お二方とも、お忙しい中ご教示いただきありがとうございました!
希望通りの表示になりましたので解決済みとさせていただきます。