Support

Account

Home Forums Front-end Issues Get a field value before Save Reply To: Get a field value before Save

  • it was easy in fact, even if getting field value is easier after the save of the post 🙂

    function argu19_set_ending_date_if_empty( $post_id ) {
    	if ( !isset($_POST['acf']['field_5bd0266e9f955']) ) :
    		$value = get_field('event_startingdate');
    		update_field('event_endingdate', $value);
    	endif;
    }
    // Apply to all fields.
    add_filter('acf/save_post', 'argu19_set_ending_date_if_empty', 10, 3);