这就是最终对我起作用的原因。我用它添加了一个元盒:
<?php add_action( \'add_meta_boxes\', \'so_custom_meta_box\' );
function so_custom_meta_box($post){
add_meta_box(\'so_meta_box\', \'Additional\', \'custom_element_grid_class_meta_box\', \'event\', \'normal\' , \'high\');
}
add_action(\'save_post\', \'so_save_metabox\');
function so_save_metabox(){
global $post;
if(isset($_POST["custom_element_grid_class"])){
$region = $_POST[\'region_sel\'];
update_post_meta($post->ID, \'region_sel_meta_box\', $region);
}
}
function custom_element_grid_class_meta_box($post){
$region = get_post_meta($post->ID, \'region_sel_meta_box\', true);
?>
<label>Region: </label>
<select name="region_sel" id="region_sel">
<option value="Region1" <?php selected( $region, \'Region1\' ); ?>>Region1</option>
<option value="Region2" <?php selected( $region, \'Region2\' ); ?>>Region2</option>
</select>
<?php } ?>