I want to update post data without update post title even if user change the post title. For this functionality I have write the following codes. But it's not working. My code is as follows :
function update_post_without_update_title($post_id,$data) {
$post = get_post($post_id);
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
return;
if ($data['post_status'] == "publish"){
$data['post_title'] = $post->post_title;
}
}
add_action('pre_post_update','update_post_without_update_title',10,2);
Can you tell me what to fix here ?
Thanks in advance,