注意:未定义索引:名称在 G:\ aservera \ htdocs \ WP \ woocommerce \ wp-content \ plugins \ custom-post \ custom_post.php 在第78行
注意:未定义索引:以电子邮件发送 G:\ aservera \ htdocs \ WP \ woocommerce \ wp-content \ plugins \ custom-post \ custom_post.php 在第79行
我的代码:
function wpdocs_my_display_callback($post){
$name =get_post_meta($post->ID,'muvies_name',true);
$email =get_post_meta($post->ID,'muvies_email',true);
?>
<label for="">name:</label>
<input type="text" name="name" value="<?php echo $name;?>">
<br>
<label for="">email:</label>
<input type="text" name="email" value="<?php echo $email;?>">
<?php
}
function data_save($post_id,$post){
$name = $_POST['name'];
$email = $_POST['email'];
update_post_meta($post_id,'muvies_name', $name);
update_post_meta($post_id,'muvies_email', $email);
}
add_action('save_post','data_save',10,2);