Hi,
For my custom post type, I set title auto generated by the metabox fields. Everything works fine after saving the post the title is generated by metabox field but its not working if I do quick edit or bulk edit. It will show no title after bulk update or quick update. It only works if I open the single post and update it there.
Here is my code.
<div>function set_leasing_meta_title( $data , $postarr ) {
if($data['post_type'] == 'leasing') {
if($_POST['type_of_leasing'] == 'Shop Spaces') {
$title = $_POST['shop_station'] . ' ' . $_POST['shop_unit'];
} else {
$title = $_POST['event_station'] . ' ' . $_POST['event_unit'];
}
$post_slug = sanitize_title_with_dashes ($title,'','save');
$post_slugsan = sanitize_title($post_slug);
$data['post_title'] = $title;
$data['post_name'] = $post_slugsan;
}
return $data;
}
add_filter( 'wp_insert_post_data' , 'set_leasing_meta_title' , '500', 2 );</div>