acf_field_relationship::format_value()
This filter is applied to the $value after it is loaded from the db and before it is returned to the template
Метод класса: acf_field_relationship{}
Хуков нет.
Возвращает
$value
. (mixed) the modified value
Использование
$acf_field_relationship = new acf_field_relationship(); $acf_field_relationship->format_value( $value, $post_id, $field );
- $value (обязательный)
- -
- $post_id (обязательный)
- -
- $field (обязательный)
- -
Список изменений
С версии 3.6 | Введена. |
Код acf_field_relationship::format_value() acf field relationship::format value ACF 6.0.4
function format_value( $value, $post_id, $field ) { // bail early if no value if ( empty( $value ) ) { return $value; } // force value to array $value = acf_get_array( $value ); // convert to int $value = array_map( 'intval', $value ); // load posts if needed if ( $field['return_format'] == 'object' ) { // get posts $value = acf_get_posts( array( 'post__in' => $value, 'post_type' => $field['post_type'], ) ); } // return return $value; }