[resolved] uploaded image to post (2 posts)

  1. SSchat
    Posted 2 years ago #


    i have a front-end form, to create new post, and in where files can be 'attached'.
    Once a file is 'selected' it will be uploaded directly. And the attachment_id is saved in the form.

    Once the whole form is submitted, the post is created, and i have the post_id.

    but can i link the attachment to the post?

    i cant seem to find any function for this.
    "wp_insert_attachment" does the only job. But i have already uploaded the file. so i can not use this function.

    // brain-fart....
    Or should i just use an sql-statement for this?

  2. SSchat
    Posted 2 years ago #

    yup solved.
    i just use an sql stat for this.
    wpdb->get_results( $sql....

Topic Closed

This topic has been closed to new replies.

About this Topic