I've got a page on my Wordpress site where users can submit posts or documents through the front end. I use
wp_insert_post for the posts, and
media_handle_upload for documents.
wp_insert_post takes around 10 seconds to run, whereas
media_handle_upload is almost instant.
Why is this? I would have thought that as the former only has to insert a post, whereas the latter inserts a post and uploads an image,
media_handle_upload would take longer to run.