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.