acf_field_post_object::format_value()
This filter is appied to the $value after it is loaded from the db and before it is returned to the template
Метод класса: acf_field_post_object{}
Хуков нет.
Возвращает
$value
. (mixed) the modified value
Использование
$acf_field_post_object = new acf_field_post_object(); $acf_field_post_object->format_value( $value, $post_id, $field );
- $value (обязательный)
- -
- $post_id (обязательный)
- -
- $field (обязательный)
- -
Список изменений
С версии 3.6 | Введена. |
Код acf_field_post_object::format_value() acf field post object::format value ACF 6.0.4
function format_value( $value, $post_id, $field ) { // numeric $value = acf_get_numeric( $value ); // bail early if no value if ( empty( $value ) ) { return false; } // load posts if needed if ( $field['return_format'] == 'object' ) { $value = $this->get_posts( $value, $field ); } // convert back from array if neccessary if ( ! $field['multiple'] && is_array( $value ) ) { $value = current( $value ); } // return value return $value; }