我创建了一个自定义表来保存自定义元框中的post数据
我在将数据从自定义元框保存到自定义表时遇到问题
所以这是我的function save_meeting_meta_box()
function save_meeting_meta_box($post_id)
{
if (!isset($_POST["meta-box-nonce"]) || !wp_verify_nonce($_POST["meta-box-nonce"], basename(__FILE__)))
return $post_id;
if(!current_user_can("edit_post", $post_id))
return $post_id;
if(defined("DOING_AUTOSAVE") && DOING_AUTOSAVE)
return $post_id;
$slug = "post";
if($slug != $post->post_type)
return $post_id;
$meta_box_text_value = "";
$meta_box_dropdown_value = "";
$meta_box_checkbox_value = "";
$th_pax = "";
$th_half = "";
$th_full = "";
$Theater = "Theater";
$ClassRoom = "Class Room";
$U_Shape = "U - Shape";
$RoundTable = "Round Table";
if(isset($_POST["th_pax"]) && isset($_POST["th_half"]) && isset($_POST["th_full"]) )
{
$th_pax = $_POST["th_pax"];
$th_half = $_POST["th_half"];
$th_full = $_POST["th_full"];
}
insert($wpdb->prefix.\'meeting_options\', array(
\'post_id\' => $post_id,
\'post_setup\' => $Theater,
\'post_pax\' => $th_pax,
\'full_price\' => $th_full,
\'half_price\' => $th_half
));
}
add_action("save_post", "save_meeting_meta_box", 10, 3);
那个么,如何将自定义元数据库的数据值插入到数据库中的特定表中呢?
我不知道我是否应该使用update_post_meta()
在自定义表中插入数据而不是wp_postmeta