Home Forums Front-end Issues Dynamically Set A Front-End Form Field Reply To: Dynamically Set A Front-End Form Field

  • Your acf/pre_save_post filter does not run before the form is submited, it is run after the form is submitted. Once the form is submitted any value you passed to the original page in $_GET is lost. It cannot be used to pre-populate a field.

    In addition to this, your filter will not even work as expected. Filters like acf/pre_save_post need to be in your functions.php file or in some other file that is always loaded. Your template file will not be loaded during the form submission.

    With that said, if you want to pre-populate a field you need to use an acf/prepare_field filter.

    add_fitler('acf/prepare_field/key=field_5dba152669aaf', 'populate_vacancy_applied_for');
    function populate_vacancy_applied_for($field) {
      // only on front end
      if (is_admin()) {
        return $field;
      if (isset($_GET['vacancy'])) {
        $field['value'] = $_GET['vacancy'];
      return $field;