WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

acf_field_image::format_value() public ACF 3.6

This filter is appied to the $value after it is loaded from the db and before it is returned to the template

{} Это метод класса: acf_field_image{}

Хуков нет.


$value. (mixed) the modified value


$acf_field_image = new acf_field_image();
$acf_field_image->format_value( $value, $post_id, $field );
(mixed)($value) (обязательный)
the value which was loaded from the database
(mixed)($post_id) (обязательный)
the $post_id from which the value was loaded
(array)($field) (обязательный)
the field array holding all the field options

Список изменений

С версии 3.6 Введена.

Код acf_field_image::format_value() ACF 5.9.1

function format_value( $value, $post_id, $field ) {
	// bail early if no value
	if( empty($value) ) return false;
	// bail early if not numeric (error message)
	if( !is_numeric($value) ) return false;
	// convert to int
	$value = intval($value);
	// format
	if( $field['return_format'] == 'url' ) {
		return wp_get_attachment_url( $value );
	} elseif( $field['return_format'] == 'array' ) {
		return acf_get_attachment( $value );
	// return
	return $value;