Support

Account

Home Forums Feature Requests Dynamically Set ACF Field Default Value Reply To: Dynamically Set ACF Field Default Value

  • @commandz – Any chance you’re still checking this? (Or anyone else who understands it?) I am trying to do this very thing, but I need to populate the default value with the value of another ACF field from a specific page.

    Here’s how I tried to implement it in functions.php, but it’s not working:

    
    $address = get_field('center_address', 342);
    	
    add_filter('acf/load_field/name=contact_info',
         function($field) use ($address) {           
    	     $field['default_value'] = $address;
    	     return $field;
         }
    );

    I’m trying to populate the value of field “contact_info” with the value from “center_address”, from post 342. I’m trying to do this on a backend form on the post editing screen, not a frontend form.

    I’m using ACF Pro. The center_address and contact_person field are text fields.

    THANK YOU!