[wp-hackers] Batch-loading posts?

Otto otto at ottodestruct.com
Mon Aug 25 14:07:19 GMT 2008

On Mon, Aug 25, 2008 at 7:41 AM,  <dragonfly at dragonflyeye.net> wrote:
> Quick question I'm not getting answered in the forums: I'm creating a site
> for a band that already has a ton of pictures, video and music on their old
> site that they'd like to maintain.  In order for that content to be
> available to place into posts or elsewhere, they're going to need them to
> be associated with an attachment post, as I understand it (haven't really
> played around with WP's CMS stuff).
> So, what I've done is: I placed them all in /wp-content/uploads/2008/08.
> Now, I need a way to create a batch file that will read all these files and
> create posts to associate them with.  The trouble is that I'm finding that
> creating a post in WP is a lot more complex than I'd thought.  There isn't
> really a simple wp_create_post like there is a wp_create_user function.

Look closer at the wp_insert_attachment function. wp-includes/post.php.

More information about the wp-hackers mailing list