need to change post content before it is published. I could overwrite the native publish function but don’t want to do this.
What i’d like to do is something like:
add_action('before_publish_post','my_func');
function my_func($content){
$content = "new content";
return $content;
}
I have had a look at the ‘publish_post’ hook, but this only allows me to change the post content afer it has been published, not before.
any help would be appreciated,
cheers
It should be the filter
wp_insert_post_data
If I was really cool I’d wait until the Anniversary date of this post & do it then, but…
It’s also possible to use:
I’m coding an admin interface right now that will make use of this so I’ll report on whether it was effective. I saw one other post here related to the use of
pre_post_update
, but it claims to make use of post id as the arg- and theirpost.php
page seems to bear this out- whereas the codex states that content is the arg and that suits your purposes dead on….Seems testing will show this one way or another.
Use
save_post
hook.You can read more here: http://codex.wordpress.org/Plugin_API/Action_Reference