acf_update_nested_array()
acf_update_nested_array
This function will update a nested array value. Useful for modifying the $_POST array
Хуков нет.
Возвращает
(true|false)
.
Использование
acf_update_nested_array( $array, $ancestors, $value );
- $array (обязательный) (передается по ссылке — &)
- -
- $ancestors (обязательный)
- -
- $value (обязательный)
- -
Список изменений
С версии 5.0.9 | Введена. |
Код acf_update_nested_array() acf update nested array ACF 6.0.4
function acf_update_nested_array( &$array, $ancestors, $value ) { // if no more ancestors, update the current var if ( empty( $ancestors ) ) { $array = $value; // return return true; } // shift the next ancestor from the array $k = array_shift( $ancestors ); // if exists if ( isset( $array[ $k ] ) ) { return acf_update_nested_array( $array[ $k ], $ancestors, $value ); } // return return false; }