WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using wp_insert_post to generate posts for my site. Initially, everything works fine and it was very fast. When the number of posts accummulated to about 3000, it became very slow and now i almost cannot insert post anymore using that command. I tested the same script on another newly created database on the same server, everything runs very fast.

I have deactivated all plugins and turn off pinging service, but there is no improvement.

i used $id = wp_insert_post($array) to retrieve the post_id also. Anyone know how to resolve my problem? Is any other method to generate posts and get the post_id

Thanks for any help

share|improve this question
Can you show the complete code you're using? – Pippin Jun 24 '12 at 19:16

You shouldn't be getting this problem, I have a site with more 10000 posts using this function all the time and everything works fine. Try running a cleanup in your database to see if things get better.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.