Why does wp_insert_post() take 4.5 minutes?
I have a plugin that inserts a post. It used to run fast, but now it takes upwards of 8 minutes to do its job. I’ve used time() to calculate execution times at various stages. The part that I expected to be slow (using GD to resize images) is actually real quick. What kills me is one call to wp_insert_post() that reliably takes 259 seconds.
Following that call, I use $wpdb to insert two categories for this post and 7 postmeta values. All that database work takes ANOTHER 258 seconds. Those two numbers are suspiciously close.
Also, posting a post in the admin interface takes a hellatiously long time too. Obviously I haven’t hacked into the core code to profile it, but I’d say it’s taking at least several minutes.
I’ve run myisamchk on my databases. Several say that they are usable but could stand fixing. You think running repairs on the database might fix this?
- The topic ‘Why does wp_insert_post() take 4.5 minutes?’ is closed to new replies.