Support

Account

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/