WordPress File wp-admin/includes/post.php

wp_edit_attachments_query()

Executes a query for attachments. An array of WP_Query arguments can be passed in, which will override the arguments set by this function.

wp_write_post()

Creates a new post from the “Write Post” form using $_POST information.