title: Remove broken tags from wordpress posts
body: <p>I'm importing posts to my wordpress site from different sources. The import is done via script, using wp_insert_post function which works just fine.</p>
  
  <p>However, some posts come with a closing div that never starts and that messes up my theme.</p>
  
  <p>I noticed that this <code>&lt;/div&gt;</code> tag automatically disappears if I go to in wordpress dashboard -> edit post and simply switch from visual mode to html mode without having to manually remove the div.</p>
  
  <p>Now the question: is there a function in wordpress codex that is doing that and that I could run for the post_content before running wp_insert_post?</p>
  
  <p>Thank you!</p>