“update_post_meta” not working in “wp_insert_post_data” hook
Question
I have created the following hook in my functions.php
add_filter('wp_insert_post_data', 'ad_change_title');
function ad_change_title($data)
{
if($data['post_type'] != 'ad_listing')
return $data;
if(!is_admin())
return $data;
global $post;
update_post_meta((int)$post->ID, 'cp_entitle_englishel', (string)$_POST['qtrans_title_en']);
return $data;
}
but the update_post_meta
part. I have checked the post_id
, cp_entitle_englishel
, qtrans_title_en
values, and they are valid. Any suggestions?
0
post-meta
11 years
2012-10-08T09:22:58-05:00
2012-10-08T09:22:58-05:00 0 Answers
114 views
0
Leave an answer