Q: wp_insert_post truncates post content on quotes… is there a proper way to escape these things?

So, I’ve made my first attempt to import from the old CMS. When I bring in content, I’ve noticed that wp_insert_post seems to truncate the post_content array element on quotes (and possibly other things).

If I want to make sure content is imported as specified, what do I have to do to the content first? Do I have to run some kind of magic quotes thing, or some level of escape code?


$my_post = array();
$my_post['post_title'] = $title;
$my_post['post_content'] = $article;
$my_post['post_status'] = 'publish';
$my_post['post_author'] = 1;
$my_post['post_type'] = 'page';
$new_id = wp_insert_post( $my_post );

But $article is getting truncated. I’m assuming I should have something like:

`$article = clean_me_up_somehow($article); before the insert, but I don’t know what that is, and I can’t check 100,000 pages individually once I flip the switch and do the import.

Help appreciated.