Home › Forums › General Issues › get field in functions.php hook › Reply To: get field in functions.php hook
Hi, I was doing it like this, (I was using the update_field functions but with get_field it should work ass well)
// run AFTER ACF saves the $_POST['fields'] data
add_action('acf/save_post', 'my_acf_save_post', 20);
function my_acf_save_post( $post_id ){
$var = get_field('field_name', $post_id );
}
that should get you the saved values after they are saved, if you want to modify them before they are saved you should use :
// run before ACF saves the $_POST['fields'] data
add_action('acf/save_post', 'my_acf_save_post', 1);
and then follow the doc here:
http://www.advancedcustomfields.com/resources/actions/acfsave_post/
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.