Sign up ×  I'm trying to write a php script that I can run out
of cron to create new Wordpress pages.  Unfortunately, I can't
find any documentation on how to do this. I'm using the WP
scripts rather than directly manipulating the SQL...but still no
joy. The below runs with no errors...but also produces no pages.
I am sad.  Anyone know how to do this?          include
('/some/path/wordpress/wp-admin/admin.php');         include
('/some/path/wordpress/wp-includes/post.php');
$to_insert = array();          $to_insert['post_author'] = 0;
$to_insert['post_content'] = '<h1>Here is my
info</h1>\n<ul><li>one</li><li>two</li></ul>\n';
$to_insert['post_type'] = 'page';
$to_insert['post_status'] = 'publish';
$to_insert['post_title'] = 'We Must Test';          $result =
wp_insert_post($to_insert,true);          if (
is_wp_error($result) ) {                 echo
$result->get_error_message(); share|improve this question
migrated from May 31 '11 at 20:56   5 Answers 5  You should b