Using pre_post_update to modify $post->post_content doesn't work
-
Hi,
I wrote the following hook to replace the occurrence of “test” with “testing” . But once I press Update button I don’t see the content getting updated.
What am I missing? Can anyone please help me?
add_action( ‘pre_post_update’, ‘addrelnofollow_link’ );
function addrelnofollow_link ( $postid ) {
$post = get_post ($postid);
if ($post) {
$post->post_content = str_replace(“test”, “testing”, $post->post_content);
}
}Best regards
anees k A
- The topic ‘Using pre_post_update to modify $post->post_content doesn't work’ is closed to new replies.