Home › Forums › General Issues › How to save image URL as a Text field? › Reply To: How to save image URL as a Text field?
Something like this will work for you. You will want to expand on this function to make sure the $imagearray and several other security checks.
function my_acf_save_post( $post_id ) {
$user_id = get_current_user_id();
$imagearray = get_field('user_image','user_' . $user_id);
$imagepath = $imagearray['url'];
update_field('image_url', $imagepath);
}
add_action('acf/save_post', 'my_acf_save_post', 20);
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.