I have a plugin that uses wp_insert_post to add posts to the database.
wp_insert_post is attempting to get the post_name by sanitizing the post_title and adding hyphens.
Fine, although it removes slashes (which I nicely put in) with stripslashes and relies on the new insert function to use add_magic_quotes to put them back.
That is all fine and good, but wp_insert_post actually uses the post_name in a query before it ever gets to the insert function. The post_name_check part of wp_insert_post, to be precise.
What does this mean?
When a post title has a dodgy character, for example the apostrophe ' in Can't, it doesn't like it one bit, and hangs at post_name_check.