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

acf_revisions::wp_post_revision_fields() public ACF 1.0

This filter will add the ACF fields to the returned array Versions 3.5 and 3.6 of WP feature different uses of the revisions filters, so there are some hacks to allow both versions to work correctly

@type filter

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

Хуков нет.

Возвращает

$post_id. (int)

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

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

Код acf_revisions::wp_post_revision_fields() ACF 5.10.2

function wp_post_revision_fields( $fields, $post = null ) {

	// validate page
	if ( acf_is_screen( 'revision' ) || acf_is_ajax( 'get-revision-diffs' ) ) {

		// bail early if is restoring
		if ( acf_maybe_get_GET( 'action' ) === 'restore' ) {
			return $fields;
		}

		// allow

	} else {

		// bail early (most likely saving a post)
		return $fields;

	}

	// vars
	$append  = array();
	$order   = array();
	$post_id = acf_maybe_get( $post, 'ID' );

	// compatibility with WP < 4.5 (test)
	if ( ! $post_id ) {

		global $post;
		$post_id = $post->ID;

	}

	// get all postmeta
	$meta = get_post_meta( $post_id );

	// bail early if no meta
	if ( ! $meta ) {
		return $fields;
	}

	// loop
	foreach ( $meta as $name => $value ) {

		// attempt to find key value
		$key = acf_maybe_get( $meta, '_' . $name );

		// bail ealry if no key
		if ( ! $key ) {
			continue;
		}

		// update vars
		$value = $value[0];
		$key   = $key[0];

		// Load field.
		$field = acf_get_field( $key );
		if ( ! $field ) {
			continue;
		}

		// get field
		$field_title = $field['label'] . ' (' . $name . ')';
		$field_order = $field['menu_order'];
		$ancestors   = acf_get_field_ancestors( $field );

		// ancestors
		if ( ! empty( $ancestors ) ) {

			// vars
			$count  = count( $ancestors );
			$oldest = acf_get_field( $ancestors[ $count - 1 ] );

			// update vars
			$field_title = str_repeat( '- ', $count ) . $field_title;
			$field_order = $oldest['menu_order'] . '.1';

		}

		// append
		$append[ $name ] = $field_title;
		$order[ $name ]  = $field_order;

		// hook into specific revision field filter and return local value
		add_filter( "_wp_post_revision_field_{$name}", array( $this, 'wp_post_revision_field' ), 10, 4 );

	}

	// append
	if ( ! empty( $append ) ) {

		// vars
		$prefix = '_';

		// add prefix
		$append = acf_add_array_key_prefix( $append, $prefix );
		$order  = acf_add_array_key_prefix( $order, $prefix );

		// sort by name (orders sub field values correctly)
		array_multisort( $order, $append );

		// remove prefix
		$append = acf_remove_array_key_prefix( $append, $prefix );

		// append
		$fields = $fields + $append;

	}

	// return
	return $fields;

}