Home › Forums › General Issues › Get values from registration form › Reply To: Get values from registration form
If your create_new_user_posts() function above works, try adding the below to your code; substitute your field keys and post type.
function pre_save_company_name($post_id){
if( empty($_POST['acf']) ) { return; }
$company = $_POST['acf']['THE COMPANY NAME FIELD KEY'];
return $company;
}
add_action('acf/save_post', 'pre_save_company_name', 21);
function company_name_as_post_title( $data, $postarr ) {
if ( ! $postarr['ID'] ) return $data;
if ( $postarr['post_type'] !== 'YOUR POST TYPE' ) return $data;
$post_id = $postarr['ID'];
$company = pre_save_company_name($post_id);
if( empty($company) ) { return $data; }
$data['post_title'] = $company;
return $data;
}
add_filter( 'wp_insert_post_data', 'company_name_as_post_title', 99, 2 );
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.