How do I have Wordpress run a simple str_replace after submitting posts?

Hi All:

How can I set up my Wordpress Blog to automatically run a str_replace on all posts’ content after submitting (before inputting it into the database)? I have a key->value array of a handful of terms and what I want them replaced with. I could use a filter - but I’d rather edit the content before it’s inputted, because that’s how I want the content, ultimately.

Thanks for any help!

MR

I am assuming you are wanting to check for bad words being used in a multi author setting. You would need to edit WP’s core files, which I don’t recomment. Maybe WP Content Filter will do the job?

rguy84: the array will possibly come from a rather large xml file - I don’t want wordpress to have to go out and grab that file every time soemone wants to read an article - which is what a filter would do, right?

So are you importing outside stories into your blog, and you want to change them so that they don’t look like a direct copy?

Please explain your blog and what you want clearer.

No. It’s a football blog. On a server I have an XML file with 20k records of football player names and a hyperlink to their statistics.

I want to hyperlink each player automatically to their stats.

So after the user submits the content - I want to grab the XML file - loop through it and “str_replace(“player name”, “<a href=\“http://link.to.stats/player_name\\”>player name</a>”,$content);”

I figure if I implement a content filter it will have to run through the XML file each time someone loads a post, right?

Ah ok, you want a link adder thing so when Jerry Rice is listed you want his details. Gotcha!

My first question is do you maintain the xml file or is it something from espn?

I figure if I implement a content filter it will have to run through the XML file each time someone loads a post, right?
If done correctly the link will be stored in the post in the database

I will be maintaining it.

You might find it easier shoving the data into its own table.

i really would rather str_replace it… i know ill be messing with core files…

Ok, you will be editing wp-admin/post-new.php for blog posts.

I found WordPress › Auto Content Links « WordPress Plugins
You may want to see if you can pull WordPress › Tags Autolink « WordPress Plugins apart for your liking.

Thanks lemme check it out! Thanks again!

Welcome, you are fast

haha thanks.

Any chance you know how to work the Wordpress / Facebook like connection? I’m getting the blog info in my facebook like’s and would rather just the title. I can have it post just the article title if the person clicks like on the single page - but I don’t know how to change the meta info for each individual article that is listed on the homepage. Any idea?

Oh you want to edit a single post title basically? If not please provide detail/example.

Basically on another site I run, BaseballMoves.com | Fantasy Baseball news, analysis, draft guide, projections, cheatsheets - if you click like on an article on the index OR on the individual post pages it posts to facebook the title of the article + the blog info (i.e. it doesn’t just post to facebook “Boston General Hospital” it posts “Boston General Hospital | Fantasy Baseball news, analysis, draft guide, projections, cheatsheets” - I want it to post just the article title to facebook …

Does that make sense?

That is what I thought you meant. I assume you are using some plugin for that. You will need to edit it. I think that is calling bloginfo, try adjusting it to wp_title()