Daily Archives: January 6, 2013


WordPress filter when inserting post breaks my html

I’m programmatically inserting posts into wordpress and all of a sudden the drop down box I’d coded into the content was getting changed sometime between when I’d call wp_insert_post and when it gets saved in the database. The select and option tags would get stripped out and a p tag would get tossed in there randomly. The solution was to disable the filtering wordpress does on the $postarr by doing the following:

kses_remove_filters();
wp_insert_post( $postArray );
kses_init_filters();