0
我試圖從類型庫(多個文件)上傳和保存文件在後期元字段中,我使用pods插件來創建此自定義字段,但是當我試圖保存該字段的附件值時保存只有第一個請任何關於如何做到這一點用wordpress函數或代碼的幫助或什麼功能在豆莢我需要使用大括號我試圖和搜索整天但我找不到我的代碼如何爲一個postmeta保存多個文件?
$uploaded_files = upload_files();
$certificates_ids = array();
foreach ($uploaded_files['certificates'] as $certificate){
$certificates_ids [] = $certificate['attach_id'];
}
$user_data = ['first_name' => $user_first_name,
'last_name' => $user_last_name,
'skype_account' => $user_skype,
'email' => $user_email,
'phone_number'=> $user_mobile,
'age'=> $user_age,
'date_of_birth' => $user_birthday,
'gender' => $user_gender,
// 'video' => pods_attachment_import($video_data),
'video' => ($uploaded_files['videoupload']['attach_id']),
'nationality' => $user_country,
'bio' =>$user_bio,
'post_title' =>$user_first_name.' '.$user_last_name,
'tutor_available_time' => $tutor_days,
'tutor_image' => pods_attachment_import($image_data),
'certificates' => json_encode($certificates_ids)
];
$pod_id = save_tutor_pod($user_data);
//save tutor pod
function save_tutor_pod($tutor_data)
{
// save new pod record
$pod = pods('tutor');
$pod_id = $pod->save($tutor_data);
// return false in case of error
if (!$pod_id)
return false;
return $pod_id;
}