Ben yazı içeriğinden onun kaydedilir (the_content) bir metin değiştirme yapan bir işlev oluşturmak için çalışıyorum.
Taslaktır fonksiyonu altında, ama nasıl yazı içeriğinden için bir referans elde edersiniz, sonra tekrar "publish_post" rutin filtrelenen içerik dönmek?
Ancak, benim yedek çalışmıyor ve / veya yayımlamak işlevine güncellenmiş post_content geçirerek değil ya. Değerler yerini asla.
function my_function() {
global $post;
$the_content = $post->post_content;
$text = " test ";
$post->post_content = str_ireplace($text, '<b>'.$text.'</b>', $the_content );
return $post->post_content;
}
add_action('publish_post', 'my_function');