Support

Account

Home Forums Front-end Issues Attach images created in front end form to custom post Reply To: Attach images created in front end form to custom post

  • Hi Elliot,
    First off i’d like to thank you for providing this wonderful plugin. It has done wonders for me so far.

    I found a dirty hack of using the ‘pre-save-post’ filter function to get the attachment ID and programmatically change the post parent. The function is:

    function attachment_change_parent($aid,$pid) {
    	global $wpdb;
    	$query = "UPDATE {$wpdb->prefix}posts
    		SET post_parent = $pid
    		WHERE ID = $aid";
    	return ($wpdb->query( $wpdb->prepare($query) )) ? true : false;
    } 

    It works so far but it is not the best option. I will eagerly await your update on this.

    Otherwise thanks again. Keep up the good hard work sir!