<?php

function homegrade_brochure_post_title_updater($post_id)
{



	$my_post = array();
	$my_post['ID'] = $post_id;

	$fields = get_fields($post_id);
	$brochureTaxonomy = $fields['publications_taxonomy'];

	if (!$post_id) return;


	if (get_post_type() == 'brochures') {
		$my_post['post_title'] = "";
		$my_post['post_title'] = $brochureTaxonomy->name;
	}


	wp_update_post($my_post);
}
add_action('acf/save_post', 'homegrade_brochure_post_title_updater', 20);
