Can you please take a look at this code and let me know why I am not able to get the Custom Post Meta on publishing the post. I tried thses
function get_cpt_meta($post_ID) {
$post = get_post($post_ID);
$meta = get_post_custom();
$mfname = $meta['f_name'][0];
$mlname = $meta['l_name'][0];
echo $mfname. " " . $mlname;
}
add_action('publish_book', 'get_cpt_meta');
and
function get_cpt_meta($post_ID) {
$post = get_post($post_ID);
$meta = get_post_custom($post);
$mfname = $meta['f_name'][0];
$mlname = $meta['l_name'][0];
echo $mfname. " " . $mlname;
}
add_action('publish_book', 'get_cpt_meta');
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744923379a4601275.html
评论列表(0条)