get_field_object()
This function will return an array containing all the field data for a given field_name
@type function
Хуков нет.
Возвращает
$field
. (array)
Использование
get_field_object( $selector, $post_id, $format_value, $load_value );
- $selector (обязательный)
- -
- $post_id **
- -
По умолчанию: false - $format_value **
- -
По умолчанию: true - $load_value **
- -
По умолчанию: true
Список изменений
С версии 3.6 | Введена. |
Код get_field_object() get field object ACF 5.10.2
function get_field_object( $selector, $post_id = false, $format_value = true, $load_value = true ) { // compatibilty if ( is_array( $format_value ) ) { extract( $format_value ); } // get valid post_id $post_id = acf_get_valid_post_id( $post_id ); // get field key $field = acf_maybe_get_field( $selector, $post_id ); // bail early if no field found if ( ! $field ) { return false; } // load value if ( $load_value ) { $field['value'] = acf_get_value( $post_id, $field ); } // format value if ( $format_value ) { // get value for field $field['value'] = acf_format_value( $field['value'], $post_id, $field ); } // return return $field; }