[wp-hackers] wp_insert_posts?

Dion Hulse (dd32) wordpress at dd32.id.au
Wed Nov 9 21:27:07 UTC 2011


Unfortunately not. The Insert API is designed for a single post insert as
it needs to retrieve the ID afterwards for setting post meta and
categories/etc.

If you've got a lot of data to import, I'd usually just use direct SQL if
it's just the posts, or deal with the wp_insert_post() if there's other
non-wp_posts data included.

On 10 November 2011 08:12, Ryan Frankel <ryan.frankel at gmail.com> wrote:

> All,
>  Is there a function similar to wo_insert_post that can INSERT multiple
> posts into the db at the same time (i.e. not call INSERT over and over)?  I
> have thousands of posts to insert into my db from an API pretty often and
> it looks like the long pole in the execution time is all of the inserts.
>  It would be nice to have a function like wp_insert_posts for multiple post
> additions using multiple VALUEs that mysql supports.  I realize I can
> probably modify the wp_insert_post code to do it but I figured I would ask
> so I don't reinvent the wheel.
>
> ryan
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list