У меня странная проблема с get_post_meta и созданием массива ...
См. Следующий код ....
if (!empty(get_post_meta(get_current_user_id(), 'samples_id'))) {
foreach(get_post_meta(get_current_user_id(), 'samples_id') As $index => $OneSample) {
$all_samples[] = $OneSample;
}
}
$all_samples[] = $sample;
update_post_meta(get_current_user_id(), 'samples_id', $all_samples);
Результаты выглядят так:
array(1) {
[0]=>
array(2) {
[0]=>
array(1) {
[0]=>
string(5) "21865"
}
[1]=>
string(5) "21875"
}
}
Результат должен быть следующим:
array(2) {
[0]=>
string(5) "21865"
[1]=>
string(5) "21875"
}