Title: HTML in post_content
Last modified: August 21, 2016

---

# HTML in post_content

 *  [Dan-BTP](https://wordpress.org/support/users/dan-btp/)
 * (@dan-btp)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/html-in-post_content/)
 * I’m exporting all the posts in my blog to an XML file.
 * As a separate step, in my VB.NET program, I’m reading that XML file, generating
   a PHP file from it, and executing that PHP file in a Command Prompt window. The
   PHP file that it’s generating looks like the following:
 *     ```
       <?php
         require_once('D:\\Path\\To\\My\\Blog\\wp-config.php');
         $wp->init(); $wp->parse_request(); $wp->query_posts();
         $wp->register_globals(); $wp->send_headers();
         global $wpdb;
   
         $post1 = array(
           'post_content'   => 'This is a test.',
           'post_title'     => wp_strip_all_tags('My Title'),
           'post_status'    => 'publish',
           'post_type'      => 'post',
           'post_author'    => 1,
           'ping_status'    => 'open',
           'post_parent'    => 0,
           'post_password'  => '',
           'post_excerpt'   => '',
           'post_date'      => '2014-3-27 13:11:40',
           'post_date_gmt'  => '2014-3-27 18:11:40',
           'comment_status' => 'open'
         );
   
         $post_id1 = wp_insert_post( $post1, $wp_error );
       ?>
       ```
   
 * However, instead of one line of post_content, there are multiple lines with HTML
   markup and other tagging. When I insert the exact post content that I read from
   the XML file, the PHP file won’t execute.
 * How do I insert the content into the post_content field of the PHP file? Thanks!

The topic ‘HTML in post_content’ is closed to new replies.

## Tags

 * [export](https://wordpress.org/support/topic-tag/export/)
 * [html](https://wordpress.org/support/topic-tag/html/)
 * [wp_insert_post](https://wordpress.org/support/topic-tag/wp_insert_post/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [Dan-BTP](https://wordpress.org/support/users/dan-btp/)
 * Last activity: [12 years, 1 month ago](https://wordpress.org/support/topic/html-in-post_content/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
