没关系,我把整个过程复杂化了,因为我没有考虑只使用get\\u post\\u meta()。
add_action(\'draft_to_publish\',\'gcpl_draft_to_published\');
function gcpl_draft_to_published($post){
$exp_processed = get_post_meta($post->ID, \'_expiration-date-processed\', true);
// check if the custom field has a value
if($exp_processed != \'\') {
delete_post_meta($post->ID, \'_expiration-date-processed\');
}
}