[wp-pro] Re: creating a new post (ML)
Scot Hacker
shacker at berkeley.edu
Mon Mar 17 17:27:23 GMT 2008
>
> Message: 1
> Date: Fri, 14 Mar 2008 17:32:36 +0000
> From: ML <utugau at gmail.com>
> Subject: [wp-pro] creating a new post
>
> I need to create a php script to populate a wordpress database with
> posts.
> That script is to be run by terminal (not thru the web) and will
> read the
> posts from a text file and insert them on the WP database. This
> script is to
> be run without wordpress.
Create a script that lives inside a theme folder and that includes the
WP header (like you would find near the top of index.php):
<?php
get_header();
?>
then gather up your title, content, etc. vars and pass them to the
wp_insert_post function:
http://codex.wordpress.org/Function_Reference/wp_insert_post
Then run your script from the command line from the theme dir.
./s
More information about the wp-pro
mailing list