我已将以下内容用于我创建的自定义字段,并且效果很好。
<?php
// Save Fields
add_action('save_post', 'save_details');
function save_details(){
if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )
return $post_id;
global $post;
update_post_meta($post->ID, "event_featuring", $_POST["event_featuring"]);
update_post_meta($post->ID, "event_time", $_POST["event_time"]);
update_post_meta($post->ID, "event_date", $_POST["event_date"]);
update_post_meta($post->ID, "event_end_date", $_POST["event_end_date"]);
update_post_meta($post->ID, "event_location", $_POST["event_location"]);
update_post_meta($post->ID, "bhs_event", $_POST["bhs_event"]);
}
?>