acf_revisions::wp_post_revision_field()publicACF 1.0

wp_post_revision_field

This filter will load the value for the given field and return it for rendering

Метод класса: acf_revisions{}

Хуков нет.

Возвращает

$value. (string)

Использование

$acf_revisions = new acf_revisions();
$acf_revisions->wp_post_revision_field( $value, $field_name, $post, $direction );
$value (обязательный)
-
$field_name (обязательный)
-
$post **
-
По умолчанию: null
$direction **
-
По умолчанию: false

Код acf_revisions::wp_post_revision_field() ACF 6.0.4

function wp_post_revision_field( $value, $field_name, $post = null, $direction = false ) {

	// bail early if is empty.
	if ( empty( $value ) ) {
		return $value;
	}

	$value   = maybe_unserialize( $value );
	$post_id = $post->ID;

	// load field.
	$field = acf_maybe_get_field( $field_name, $post_id );

	// default formatting.
	if ( is_array( $value ) ) {
		$value = implode( ', ', $value );
	} elseif ( is_object( $value ) ) {
		$value = serialize( $value );
	}

	// image.
	if ( is_array( $field ) && isset( $field['type'] ) && ( $field['type'] === 'image' || $field['type'] === 'file' ) ) {
		$url   = wp_get_attachment_url( $value );
		$value = $value . ' (' . $url . ')';
	}

	return $value;
}