According to the documentation (if I am reading it correctly) the following should autofill myACFfieldname field;
contained within themes>functions.php
function my_acf_update_value( $value, $post_id, $field )
{
$value = "Autofill-Text";
return $value;
}
add_filter('acf/update_value/name=myACFfieldname', 'my_acf_update_value', 10, 3);
Appreciate if somebody can point out the obvious misunderstanding.
Hi @rotorbit69,
Thanks for the post.
Yes the code appears to be correct and the set value should override the one entered on the post edit page.
Please debug your code to check if the new value has been set through:
<?php
$field_value = get_field('myACFfieldname');
echo '<pre>';
var_dump( $field_value );
echo '</pre>';
?>