Hi,
I am looking to output the content from an ACF user field. For the Current Users “Company Name”.
I want this to be the default value of an ACF field when they add a new post.
The output I have is <?php the_field( ‘company_name’, $user_id_prefixed ); ?> but this just brings back this when creating a post and not the field text.
I need this to display the output in the WordPress backend.
Is this possible?
See acf/prepare_field. Using this filter you can set the default value of a field from the field on the user page.
add_filter('acf/prepare_field/name=your_field_name', 'default_user_company', 20);
function default_user_company($field) {
$field['defualt_value'] = get_field('company_name', 'user_'.get_current_user_id());
return $field;
}