I want to let my website user to upload files in a form and then send them attached to email. HOwever I cant find way to get links to those files. I used this code
$attachment_links = array();
$attachments = get_posts(array( 'post_type' => 'attachment',
'numberposts' => -1,
'post_status' =>'any',
'post_parent' => $post->ID
));
if ($attachments) {
foreach ( $attachments as $attachment ) {
echo apply_filters( 'the_title' , $attachment->post_title );
$attachment_links[$attachment->ID]=the_attachment_link( $attachment->ID , true );
}
}
wp_mail( $emailTo, $subject, $body, $headers, $attachment_links );
But that doesnt work. Actually the file being uploaded do not get attached to the post.
http://wordpress.org/plugins/wp-multi-file-uploader/