I’ve been engaged on this resolution, I’ve provide you with a distinct thought to implement this –
I’ve added two completely different meta packing containers, one with First Title, the opposite with Final Title
Then I’ve hooked a perform with save_post_{$post->post_type}
hook like this –
add_action( "save_post_{$post->post_type}", "update_post_data" );
perform update_post_data( $post_id ) {
// Unhook to cease infinite loop.
remove_action( "save_post_{$post->post_type}", "update_post_data" );
$fname = sanitize_title( get_post_meta( $post_id, '_first_name', true ) );
$lname = sanitize_title( get_post_meta( $post_id, '_last_name', true ) );
$post_title = ucwords( $fname . ' ' . $lname );
$post_name = $fname . '-' . $lname;
$args = [
'post_title' => $post_title,
'post_name' => $post_name,
];
// Replace submit knowledge.
wp_update_post( $args );
// Re-hook the perform, to make it work in future.
add_action( "save_post_{$post->post_type}", "update_post_data" );
}