You do global $post, but at the time content_save_pre runs, no $post object exists (since you are right before saving it). Could this be your problem?
–
Jan FabryNov 4 '10 at 15:52

@Jan: that certainly sounds logical, but I'm able to echo $post->ID inside of save_content(). How can this be possible?
–
Scott BNov 4 '10 at 18:10

It appears a draft post is saved in the database, which is later overwritten by the actual post data? So I think you are getting the data of this draft post. Can you debug what rseo_getKeyword() returns there? Have you tried preg_replace_callback() with a fixed keyword?
–
Jan FabryNov 4 '10 at 18:25

Indeed, in a normal regex callback you want to return the replacement string. But Scott is probably debugging, and then this code should echo the output to the screen and die, no?
–
Jan FabryNov 4 '10 at 15:28

But, still... nothing gets echoed to the screen during the save_content, does it? I was under the impression it was done as an AJAX request, so trying to echo something would have no visual effect. I would think you'd be better off returning a value into your post that you could check for later.
–
goldenapplesNov 4 '10 at 18:59

Shouldn't the preg_quote() call be used in an array map call? If you're feeding it something like "foo|bar" it'll get escaped as "foo\|bar", which won't match anything... Better use something like this: