Support

Account

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

  • Done and it works! 🙂

    You are my hero! The error was coz of a typo on filter (typed it as fitler).

    Here is the tweaked code snippet just in case anyone else ever wants to achieve the same thing.

    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;
    }
    
    add_filter('acf/prepare_field/key=field_5dba152669aaf', 'populate_vacancy_applied_for');