我创建了一个向帖子中添加一些元文件的功能。 我对附加图像中显示的框有问题。我的客户抱怨由于某种原因在任何随机时刻元变量消失并且所有信息都在他们身上,就像一些身体按下删除并保存帖子。
这是我用来保存和更新元变量的代码:
//Save product price
add_action('save_post', 'save_detailss');
function save_detailss($post_id){
global $post;
// to prevent metadata when the post is saved on the Quick Edit mode
if (wp_verify_nonce($_POST['_inline_edit'], 'inlineeditnonce'))
return;
// to prevent metadata or custom fields from disappearing
if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )
return $post_id;
if (isset($_POST['more_info_data'])){
$data = $_POST['more_info_data'];
update_post_meta($post_id,'more_info_data',$data);
}else{
delete_post_meta($post_id,'more_info_data');
}
}
提前非常感谢!