acf_extract_var()
This function will remove the var from the array, and return the var
Хуков нет.
Возвращает
Разное
. Extracted var or default.
Использование
acf_extract_var( $extract_array, $key, $default_value );
- $extract_array(массив) (обязательный) (передается по ссылке — &)
- an array passed as reference to be extracted.
- $key(строка) (обязательный)
- The key to extract from the array.
- $default_value(разное)
- The default value if it doesn't exist in the extract array.
По умолчанию: null
Список изменений
С версии 5.0.0 | Введена. |
Код acf_extract_var() acf extract var ACF 6.4.2
function acf_extract_var( &$extract_array, $key, $default_value = null ) { // check if exists - uses array_key_exists to extract NULL values (isset will fail). if ( is_array( $extract_array ) && array_key_exists( $key, $extract_array ) ) { // store and unset value. $v = $extract_array[ $key ]; unset( $extract_array[ $key ] ); return $v; } return $default_value; }