Skip to content

Instantly share code, notes, and snippets.

@al5dy
Last active July 2, 2016 10:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save al5dy/201dcf85e1ee4260311aa682bacdd32c to your computer and use it in GitHub Desktop.
Save al5dy/201dcf85e1ee4260311aa682bacdd32c to your computer and use it in GitHub Desktop.
Получаем массив мета поля и удаляем значение под индексом "1" и далее выводим новый массив с обновленными ключами.
$list_of_values = get_post_meta($post->ID, $this->meta . 'custom_field', true );
if (! empty ( $list_of_values )) {
unset($list_of_values[1]);
}
var_dump(array_combine(range(1, count($list_of_values)), array_values($list_of_values)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment