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!
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.