Support

Account

Home Forums Backend Issues (wp-admin) How to populate Title from a different field Reply To: How to populate Title from a different field

  • //add title and alias when a person is created
    function my_acf_update_titlevalue( $value, $post_id, $field ) {
    global $post;
    	// vars (title comes from person_name field that is looked for at the filter, after that the alias is generated)	
    	$new_title = $value;
    	$new_slug = sanitize_title( $new_title );
    	// update post with the "new" title and alias (because we may hide them at our custom post)
    	$my_post = array('ID'=> $post_id,'post_title' => $new_title,'post_name' => $new_slug );
    wp_update_post( $my_post );
    return $value;
    }
    add_filter('acf/update_value/name=person_name', 'my_acf_update_titlevalue', 10, 3);

    try something like above at your plugin: change person_name to your acf field
    hope that help and work for you